r/node 4d ago

I modified the tsconfig.json generated by AWS CDK, can you spot something wrong?

tsconfig.json generated by AWS CDK

{
  "compilerOptions": {
    "alwaysStrict": true,
    "declaration": true,
    "experimentalDecorators": true,
    "inlineSourceMap": true,
    "inlineSources": true,
    "isolatedModules": true,
    "lib": [
      "es2022"
    ],
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "noEmit": true,
    "noFallthroughCasesInSwitch": false,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "skipLibCheck": true,
    "strict": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": false,
    "target": "ES2022",
    "typeRoots": [
      "./node_modules/@types"
    ],
    "types": [
      "node"
    ]
  },
  "exclude": [
    "node_modules",
    "cdk.out"
  ]
}

tsconfig.json generated by me for node:22.12.0-bookworm-slim

{
  "compilerOptions": {
    "allowJs": true,
    "declaration": true,
    "experimentalDecorators": true,
    "noFallthroughCasesInSwitch": false,
    "noImplicitReturns": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "outDir": "dist",
    "rootDir": "./",
    "sourceMap": true,
    "strictPropertyInitialization": false
  },
  "exclude": [
    "dist",
    "cdk.out",
    "node_modules"
  ],
  "extends": "@tsconfig/node22/tsconfig.json",
  "include": [
    "src/**/*"
  ]
}
0 Upvotes

4 comments sorted by

3

u/Carlos_Menezes 4d ago
"allowJs": true

There's your problem.

2

u/glandix 4d ago

Is there something wrong or not working correctly? Might get better answers if you explained the issue or what you’re trying to solve. The “right” tsconfig.json depends on your project