Skip to content

Commit

Permalink
fix(init-templates): add typesRoot compiler option for TypeScript tem…
Browse files Browse the repository at this point in the history
…plates (#3865)

Closes #3830 

Given a project structure where the cdk (init) generated `node_modules` has a parent node project with its own `node_modules` folder with failing typescript code, the CDK will not compile because `tsc` traverses the directory structure looking for type definitions.

This small change adds the `typesRoot` [compiler option](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types) essentially rooting the typescript compiler to look for types under the `cdk_root_folder/node_modules/@types`.
  • Loading branch information
carlosrfernandez authored and rix0rrr committed Sep 2, 2019
1 parent 9a229d9 commit 2c9bafa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization":false
"strictPropertyInitialization":false,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["cdk.out"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization":false
"strictPropertyInitialization":false,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["cdk.out"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"strictPropertyInitialization":false,
"allowJs": true,
"checkJs": true,
"noEmit": true
"noEmit": true,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["cdk.out"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"inlineSourceMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization":false
"strictPropertyInitialization":false,
"typeRoots": ["./node_modules/@types"]
},
"exclude": ["cdk.out"]
}

0 comments on commit 2c9bafa

Please sign in to comment.