Describe the bug
Given the following tsconfig.json:
{
"lib": ["ESNext"],
"moduleResolution": "node",
"module": "commonjs",
"target": "ES2020",
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "dist",
"rootDir": "./",
"strict": true,
"noImplicitAny": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"removeComments": true,
"sourceMap": true,
"strictPropertyInitialization": false
}
Any option that is set to false is omitted from the tsc command line options. This results in failed compilations during cdk synthesis whereas building directly with tsc does not fail.
Expected Behavior
Command line options should be (newlines added for readability):
--lib ESNext
--moduleResolution node
--module commonjs
--target ES2020
--baseUrl .
--allowSyntheticDefaultImports
--experimentalDecorators
--emitDecoratorMetadata
--esModuleInterop
--skipLibCheck
--outDir ./
--rootDir ./
--strict
--noImplicitReturns
--noFallthroughCasesInSwitch
--removeComments
--sourceMap
--noImplicitAny false
--strictNullChecks false
--noUnusedLocals false
--noUnusedParameters false
Current Behavior
Command line options are (newlines added for readability):
--lib ESNext
--moduleResolution node
--module commonjs
--target ES2020
--baseUrl .
--allowSyntheticDefaultImports
--experimentalDecorators
--emitDecoratorMetadata
--esModuleInterop
--skipLibCheck
--outDir ./
--rootDir ./
--strict
--noImplicitReturns
--noFallthroughCasesInSwitch
--removeComments
--sourceMap
Reproduction Steps
tsconfig.json
{
"compilerOptions": {
"lib": ["ESNext"],
"moduleResolution": "node",
"strictPropertyInitialization": false
}
}
person.ts
export class Person {
name: string;
email: string;
constructor(name: string) {
this.name = name;
}
}
index.ts
import { Person } from 'person';
const Jeff = new Person("Jeff");
console.log('Hello ' + Jeff.name);
Possible Solution
Change:
|
if (value) { |
|
compilerOptionsString += option + ' '; |
|
} |
to
if (value) {
compilerOptionsString += option + " "
} else {
compilerOptionsString += option + " false "
}
CDK CLI Version
2.27.0 (build 8e89048)
Framework Version
No response
Node.js Version
v18.2.0
OS
Ubuntu 22.04 LTS
Language
Typescript
Language Version
Typescript (4.7.2)
Other information
No response
Describe the bug
Given the following tsconfig.json:
{ "lib": ["ESNext"], "moduleResolution": "node", "module": "commonjs", "target": "ES2020", "allowSyntheticDefaultImports": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "esModuleInterop": true, "skipLibCheck": true, "outDir": "dist", "rootDir": "./", "strict": true, "noImplicitAny": false, "strictNullChecks": false, "noUnusedLocals": false, "noUnusedParameters": false, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "removeComments": true, "sourceMap": true, "strictPropertyInitialization": false }Any option that is set to false is omitted from the tsc command line options. This results in failed compilations during cdk synthesis whereas building directly with tsc does not fail.
Expected Behavior
Command line options should be (newlines added for readability):
Current Behavior
Command line options are (newlines added for readability):
--lib ESNext --moduleResolution node --module commonjs --target ES2020 --baseUrl . --allowSyntheticDefaultImports --experimentalDecorators --emitDecoratorMetadata --esModuleInterop --skipLibCheck --outDir ./ --rootDir ./ --strict --noImplicitReturns --noFallthroughCasesInSwitch --removeComments --sourceMapReproduction Steps
tsconfig.json
{ "compilerOptions": { "lib": ["ESNext"], "moduleResolution": "node", "strictPropertyInitialization": false } }person.ts
index.ts
Possible Solution
Change:
aws-cdk/packages/@aws-cdk/aws-lambda-nodejs/lib/util.ts
Lines 176 to 178 in 5696c5d
to
CDK CLI Version
2.27.0 (build 8e89048)
Framework Version
No response
Node.js Version
v18.2.0
OS
Ubuntu 22.04 LTS
Language
Typescript
Language Version
Typescript (4.7.2)
Other information
No response