feat: add tsconfig with strict flags for additional safety
This commit is contained in:
47
tsconfig.json
Normal file
47
tsconfig.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Base strict mode
|
||||
"strict": true,
|
||||
|
||||
// === THE FIVE EXTRA FLAGS ===
|
||||
|
||||
// 1. Array/object indexing returns T | undefined (not just T)
|
||||
"noUncheckedIndexedAccess": true,
|
||||
|
||||
// 2. Optional properties (?) mean "absent", not "undefined"
|
||||
"exactOptionalPropertyTypes": true,
|
||||
|
||||
// 3. Forces obj["key"] syntax for index signatures (explicit about dynamic access)
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
|
||||
// 4. Error on unused local variables
|
||||
"noUnusedLocals": true,
|
||||
|
||||
// 5. Error on unused function parameters
|
||||
"noUnusedParameters": true,
|
||||
|
||||
// === ADDITIONAL SAFETY ===
|
||||
|
||||
// Error if switch case falls through without break
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
// Error if function doesn't explicitly return in all paths
|
||||
"noImplicitReturns": true,
|
||||
|
||||
// Force consistent casing in imports (catches cross-platform bugs)
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
// Ensure imports resolve correctly
|
||||
"moduleResolution": "bundler",
|
||||
"module": "ESNext",
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
|
||||
// Isolated builds (required for most bundlers)
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
|
||||
// Skip type-checking node_modules
|
||||
"skipLibCheck": true,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user