admin管理员组文章数量:1435859
I am trying to build a Node.js project from a few years ago and I'm encountering TypeScript compiler issues that were not present back in the days. Although I am using the exact same node version my project fails to build. The GitHub Actions workflows from that time also went through successfully, but also not anymore.
The TS compiler is actually correct with the complaints, but I want to compile it to find the cause of a regression and I don't want to fix hundreds of these new errors.
/Users/user/Desktop/g2d/node_modules/ts-node/src/index.ts:859
return new TSError(diagnosticText, diagnosticCodes, diagnostics);
^
TSError: ⨯ Unable to compile TypeScript:
../g2d/src/main.ts(140,40): error TS2571: Object is of type 'unknown'.
../g2d/src/main.ts(199,40): error TS2571: Object is of type 'unknown'.
../g2d/src/main.ts(240,11): error TS2532: Object is possibly 'undefined'.
../g2d/src/main.ts(244,42): error TS2571: Object is of type 'unknown'.
../g2d/src/main.ts(272,42): error TS2571: Object is of type 'unknown'.
../g2d/src/main.ts(307,42): error TS2571: Object is of type 'unknown'.
All dependencies in package.json
are locked to its minor version, and I am using the same node version 14.17.6
. Can anyone explain me why my project fails with a seamingly more strict setting?
"engines": {
"node": "14.17.6"
},
"dependencies": {
"some-dependency": "1.2.3",
...
},
"dependencies": {
"ts-node": "10.9.1",
"typescript": "4.8.2",
...
}
The tsconfig.json
looks as follows:
{
"ts-node": {
"swc": true
},
"compilerOptions": {
// Basic configuration
"incremental": true,
"module": "CommonJS",
"rootDir": ".",
"outDir": "dist",
"sourceMap": true,
"declaration": true,
"target": "ES2021",
// Type checking options
"strict": false,
"noImplicitAny": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictPropertyInitialization": false,
"noImplicitReturns": false,
"noUncheckedIndexedAccess": false,
// Code quality options
"allowUnreachableCode": true,
"allowUnusedLabels": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
// Module resolution
"resolveJsonModule": true,
"moduleResolution": "node",
"esModuleInterop": true,
// Library definitions
"typeRoots": [
"node_modules/@types"
],
"lib": [
"ES2021"
],
// Skip unnecessary checks
"skipLibCheck": true
},
"include": [
"src/**/*.ts",
"test/**/*.ts"
],
"exclude": [
"node_modules"
]
}
本文标签: nodejsTypeScript compiler suddenly became more strictStack Overflow
版权声明:本文标题:node.js - TypeScript compiler suddenly became more strict - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745673501a2669711.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论