‘package.json’ is not under ‘rootDir’

This is possible, and it turns out, not hard. The reason the solution is not obvious is because typescript relies on the rootDir to decide the directory structure of the output (see this comment from Typescript’s bossman), and only code included in the output or in package dependencies can be imported. If you set rootDir … Read more

Overriding `tsconfig.json` for ts-node in mocha

You need to set the configuration through the TS_NODE_COMPILER_OPTIONS environment variable Example code on an unix machine: TS_NODE_COMPILER_OPTIONS='{“module”:”commonjs”}’ \ mocha –require ts-node/register ‘test/**/*.spec.{ts,tsx}’ Explanation extracted from the repository documentation CLI and Programmatic Options Environment variable denoted in parentheses. -T, –transpile-only Use TypeScript’s faster transpileModule (TS_NODE_TRANSPILE_ONLY, default: false) -I, –ignore [pattern] Override the path patterns to … Read more

Problem with Visual Studio Code using “react-jsx” as jsx value with create-react-app

This is because VSCode’s Typescript version is not using the newest babel features that create-react-app uses by default. You can change VS Code to use the workspace’s version of Typescript instead, which will fix this issue. Open a TypeScript or JavaScript file and click on the TypeScript version number in the Status Bar. A message … Read more

How to use multiple tsconfig files in vs-code?

These days it is much easier as vscode has better support for this. You can use this directory structure so all the code is independent: ├── frontend/ │ ├── src/ │ │ ├── <frontend code> │ ├── package.json │ ├── tsconfig.json ├── shared/ │ ├── package.json ├── backend/ │ ├── src/ │ │ ├── <backend … Read more

Setting up tsconfig with spec/test folder

I ended up defining multiple config files and use extends to simplify them. Say I have two files: tsconfig.json and tsconfig.build.json // tsconfig.json { … “exclude”: […] } // tsconfig.build.json { … “files”: [ “typings/index.d.ts”, “src/index.ts” ] } This way, I can have fine control on what to build (using tsc -p tsconfig.build.json) and what … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)