Skip to content

Commit a958621

Browse files
KyleTryonclaude
andauthored
feat: enhanced typescript options (#100)
* chore(typescript): add enhanced compiler options Add 5 strict TypeScript compiler options to improve type safety: - noUncheckedIndexedAccess: Ensures array access returns T | undefined - useUnknownInCatchVariables: Catch variables typed as unknown - allowUnreachableCode: Disallow unreachable code - allowUnusedLabels: Disallow unused labels - noImplicitOverride: Require explicit override keyword Applied across all packages (api, app, tricorder) for consistent type safety standards. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * fix(api): resolve type errors from enhanced TypeScript options Fix ~100 type errors across API routers to comply with stricter TypeScript configuration: - Add non-null assertions after explicit runtime checks - Use optional chaining for regex match groups - Add explicit null checks for database .returning() calls - Extract pagination params to preserve Zod default values - Fix array access patterns with length guards All changes maintain runtime safety while satisfying strict type checking. No behavior changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> * refactor(api): extract shared schemas and helpers in admin router Reduce code duplication in admin.ts by extracting reusable components: - Extract blockedDomainReasonSchema (used 8 times, saves ~60 lines) - Extract planOutputSchema (used 2 times, saves ~12 lines) - Extract globalSettingsOutputSchema - Add transformAdminUser() helper (saves ~60 lines) - Add formatGlobalSettings() helper (saves ~13 lines) Net reduction: 56 lines removed (278 deleted, 222 added) All tests passing, no behavior changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 125bf83 commit a958621

File tree

15 files changed

+400
-326
lines changed

15 files changed

+400
-326
lines changed

packages/api/src/cli/create-admin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async function main() {
8181
console.log(`✅ Successfully promoted '${username}' to admin`);
8282
console.log(` User ID: ${user.id}`);
8383
console.log(` Email: ${user.email}`);
84-
console.log(` Plan: ${updatedUser.plan}`);
84+
console.log(` Plan: ${updatedUser?.plan ?? "unknown"}`);
8585

8686
sqlite.close();
8787
process.exit(0);

packages/api/src/hono/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,5 +307,5 @@ function getCorsOrigins(env: Env): string | string[] {
307307
? []
308308
: ["http://localhost:5173", "http://localhost:3000"];
309309

310-
return allowedOrigins.length === 1 ? allowedOrigins[0] : allowedOrigins;
310+
return allowedOrigins.length === 1 ? allowedOrigins[0]! : allowedOrigins;
311311
}

0 commit comments

Comments
 (0)