在我升级到Typescript 2.9.1(从2.8升级到2.8)后,我遇到了编译错误:
node_modules/typescript/lib/lib.es2017.full.d.ts:33:11 - error TS2300: Duplicate identifier 'Account'.
当我使用Typescript2.7和2.8时,这种情况从来没有发生过。
环境:
node_module
文件夹中,没有全局typescript)// tsconfig.json { "compilerOptions": { "module": "commonjs", "target": "es2017", "noImplicitAny": true, "moduleResolution": "node", "sourceMap": true, "outDir": "ts-build", "baseUrl": ".", "paths": { "kernel/*": [ "./server/kernel/*" ] }, "rootDir": ".", "allowJs": true, "typeRoots": [ "node_modules/@types" ], "emitDecoratorMetadata": true, "experimentalDecorators": true, "types": [], "keyofStringsOnly": true }, "include": [ "server/**/*", "app.*.js" ], "exclude": [ "node_modules" ] }
只是一个解决办法,我使用skiplibcheck:true
绕过lib文件中的类型检查,这样就不会出现错误。但我仍然不知道为什么会在2.9.1中发生这种情况。