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"
]
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745673501a4639546.html
评论列表(0条)