config icon indicating copy to clipboard operation
config copied to clipboard

tsconfig "extends" not used

Open garrettjstevens opened this issue 4 years ago • 1 comments

Thanks for this project! It's been really useful to me. One thing I noticed is that it looks like the tsconfig.json is parsed here:

https://github.com/oclif/config/blob/25ea41291d69c6f8878aa793fd0fd41469acccce/src/ts-node.ts#L37-L40

and used in a few places, including here:

https://github.com/oclif/config/blob/25ea41291d69c6f8878aa793fd0fd41469acccce/src/ts-node.ts#L73-L77

However, if you have your oclif tsconfig.json extend another tsconfig.json (e.g. in a monorepo setup) like this:

tsconfig.json

{
  "compilerOptions": {
    "target": "es2016",
    "esModuleInterop": true,
  },
}

packages/my-oclif-project/tsconfig.json

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "declaration": true,
    "importHelpers": true,
    "module": "commonjs",
    "outDir": "lib",
    "rootDir": "src",
    "strict": true,
    "noEmit": false,
  },
  "include": ["src"],
}

the "extends" is never followed, so the tsconfig does not inherit e.g. "target" and "esModuleInterop" from the base config. (About extending base configs: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#tsconfig-bases)

garrettjstevens avatar Sep 29 '20 14:09 garrettjstevens

+1

miserylee avatar Nov 12 '20 03:11 miserylee