Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

tsconfig "extends" not used #176

Open
garrettjstevens opened this issue Sep 29, 2020 · 1 comment · May be fixed by #177
Open

tsconfig "extends" not used #176

garrettjstevens opened this issue Sep 29, 2020 · 1 comment · May be fixed by #177

Comments

@garrettjstevens
Copy link

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:

config/src/ts-node.ts

Lines 37 to 40 in 25ea412

const tsconfig = typescript.parseConfigFileTextToJson(
tsconfigPath,
fs.readFileSync(tsconfigPath, 'utf8'),
).config

and used in a few places, including here:

config/src/ts-node.ts

Lines 73 to 77 in 25ea412

compilerOptions: {
esModuleInterop: tsconfig.compilerOptions.esModuleInterop,
target: tsconfig.compilerOptions.target || 'es2017',
experimentalDecorators: tsconfig.compilerOptions.experimentalDecorators || false,
emitDecoratorMetadata: tsconfig.compilerOptions.emitDecoratorMetadata || false,

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)

@miserylee
Copy link

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants