refactor: strictNullChecks Phase 1 — 108 erreurs corrigées (issue #376) - #386
Merged
Merged
Conversation
…(issue #376) Enable `strictNullChecks: true` in tsconfig.app.json and fix all 108 resulting type errors across 12 files. Changes by file: - tsconfig.app.json: add strictNullChecks: true - TreasureHuntCanvas.tsx: rename canvas/ctx to typed non-null vars for closure safety - PixelIcon.tsx: remove duplicate keys 'crown' and 'skull' in ICON_MAP - bestiary.ts: cast bomber.assets as BomberAssetRefs; add as BestiaryBomber[] on map() - heroVisualSystem.ts: annotate traits as HeroVisualTraits to fix helmetStyle literal type - useCloudSave.ts: add xp to PlayerHeroRowExtended; cast rarity as Rarity, family as HeroFamilyId; double-cast statsOnly as unknown as PlayerData; import Rarity, HeroFamilyId - useLeaderboard.ts: cast RPC args as never to bypass missing Supabase type definition - useMarketplace.ts: cast RPC args as never; cast data as unknown as MarketplaceListing[] - animations.ts: cast pixelSlide return as Variants to fix Framer Motion index signature - Index.tsx: type boss as Boss|null; capture stageSnapshot.boss for closure narrowing; fix storyFailed boolean|undefined with ?? false; import Boss from storyTypes - Profile.tsx: add @ts-expect-error for delete_user_account RPC (absent from generated types) - WikiPage.tsx: replace .filter(Boolean) with explicit type guard .filter((a): a is ...) Result: tsc --noEmit 0 errors, 246/246 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Résumé
Active
strictNullChecks: truedanstsconfig.app.jsonet corrige les 108 erreurs TypeScript résultantes.noImplicitAnyreste àfalse— c'est délibéré pour Phase 1.Erreurs corrigées (par fichier)
TreasureHuntCanvas.tsxcanvas/ctxen variables typées non-null après guards — TS perd le narrowing dans les closures internesPixelIcon.tsxcrownetskulldansICON_MAPbestiary.tsbomber.assets as BomberAssetRefs;as BestiaryBomber[]sur le.map()heroVisualSystem.tstraits: HeroVisualTraitspour éviter l'élargissementstringuseCloudSave.tsxpàPlayerHeroRowExtended;as Rarity,as HeroFamilyId; double-castas unknown as PlayerData; importsuseLeaderboard.tsas never(RPC absent des types générés Supabase)useMarketplace.tsas never;as unknown as MarketplaceListing[]animations.tsas Variantssur le retour depixelSlide(Framer Motion index signature)Index.tsxBoss | nullpourboss; capture closurestageSnapshotBoss;?? falsepour optionals booleanProfile.tsx@ts-expect-errorpourdelete_user_accountRPC non présent dans les types générésWikiPage.tsx.filter((a): a is NonNullable<...>)au lieu de.filter(Boolean)ProgressionPage.tsxACHIEVEMENTSimporté depuis@/game/achievements(pas@/game/types)Total : 108 erreurs → 0 erreur
Validation
npx tsc --noEmit: 0 erreurnpm test: 246/246 tests passentnpm run build: build propre (0 erreur Vite/esbuild)Notes
src/test/intact)PixelIcon.tsxcorrige aussi un bug latent : les clés dupliquées causaient des comportements imprévisiblesas neversur les RPCs Supabase sont du code pré-existant — la solution propre serait de régénérer les types Supabase, mais c'est hors scope Phase 1Closes #376
🤖 Generated with Claude Code