From 186ddabadfca1d8044feed78e634ace3b1fdf820 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 31 Mar 2026 13:22:45 +0300 Subject: [PATCH] feat: add tsconfig with strict flags for additional safety --- tsconfig.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..4dd2041 --- /dev/null +++ b/tsconfig.json @@ -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, + }, +}