9a0267dae8
The project opted into strict flags one at a time, leaving strictFunctionTypes, strictPropertyInitialization and useUnknownInCatchVariables off. Those three are the ones that catch structural mistakes rather than typos, and leaving them off meant the compiler silently accepted unsound code the codebase had no other guard against. Enabling them replaces six explicit flags with `strict: true`, which is also the compiler's own default, so the config no longer has to be kept in sync with the strict family as it evolves. The fallout was almost entirely mechanical: 287 entity, DTO and framework-injected properties have no constructor assignment because TypeORM, class-transformer and Nest populate them, and now carry a definite-assignment assertion. That syntax is erased at compile time, so runtime behaviour is unchanged. Three registries needed a real fix. Storing descriptors of different input shapes in one array relies on parameter bivariance, which strictFunctionTypes removes. Each now has an explicitly erased form whose row-consuming members take `never` — the only parameter type every concrete descriptor can be assigned to — with the single bridging cast placed at the point where the value's real type is known: the tool invoker after schema validation, and the import loop after reading a table's own rows. Three other sites were hand-rolled copies of a type the library already exports, and now use the original. useUnknownInCatchVariables also found four places interpolating a caught value straight into a message. Two of those reach operators through API responses, where a non-Error throw would have rendered as "[object Object]" instead of a cause.
33 lines
1.2 KiB
JSON
33 lines
1.2 KiB
JSON
{
|
|
"compilerOptions": {
|
|
"module": "nodenext",
|
|
"moduleResolution": "nodenext",
|
|
"resolvePackageJsonExports": true,
|
|
"esModuleInterop": true,
|
|
"isolatedModules": true,
|
|
"declaration": true,
|
|
"removeComments": true,
|
|
"emitDecoratorMetadata": true,
|
|
"experimentalDecorators": true,
|
|
"allowSyntheticDefaultImports": true,
|
|
"target": "ES2023",
|
|
"sourceMap": true,
|
|
"outDir": "./dist",
|
|
// TypeScript 6 requires the layout anchor to be explicit (TS5011). The build config narrows
|
|
// this to ./src; here it spans src + test for ts-jest and the editor.
|
|
"rootDir": ".",
|
|
"incremental": true,
|
|
"skipLibCheck": true,
|
|
// TypeScript 6 no longer auto-includes every node_modules/@types package: the globals the
|
|
// project relies on must be listed. node covers src; jest covers the colocated *.spec.ts.
|
|
"types": ["node", "jest"],
|
|
// The whole strict family, which is also TypeScript 6's own default. Entity and DTO properties
|
|
// the framework populates carry `!`, since no constructor assigns them.
|
|
"strict": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"noFallthroughCasesInSwitch": true
|
|
},
|
|
"exclude": ["node_modules", "dist", "dashboard"],
|
|
"include": ["src", "test"]
|
|
}
|