Enable noUncheckedIndexedAccess in tsconfig
Tighter type-checking: array indexing and dynamic property access now
return T | undefined rather than T. Catches bugs where code assumes a
key exists without checking.
No code changes were needed — the existing modules already either:
- cast through Record<string, unknown> (configFile.ts), where access
is already 'unknown';
- cast values from parseArgs to '... | undefined' (cli.ts), already
nullable; or
- use static, statically-known fields (Config, ConfigOverrides,
DEFAULT_CONFIG).
tsc --noEmit remains clean. The full test suite still passes.
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"resolveJsonModule": true
|
"resolveJsonModule": true,
|
||||||
|
"noUncheckedIndexedAccess": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts"]
|
"include": ["src/**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user