楽にLintを導入したかっただけなのに
$ npx gts init
何も考えずOverwriteポチー
エラーの山が襲来
AoT buildができない!
多すぎて一部抜粋。
これとか
addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;
これとか
src/main.ts:12:17 - error TS2584: Cannot find name 'console'. Do you need to change your target library? Try changing the `lib` compiler option to include 'dom'.
⇒ gtsでtsconfig.jsonが上書きしてしまったことが原因。
解決法
tsconfig.jsonのtargetやlibを戻せば解決した。
tsconfig.json
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}