feat(ts): typecheck requires a tsconfig and type-checks Deno code - #33
Merged
Merged
Conversation
Found adopting v2 in tech-atlas: its typecheck was `astro check` with no tsconfig, which exits 0 after checking only .astro files with loose defaults, so src/lib, tests and scripts were never type-checked. That hid 124 errors. Its Supabase Edge Functions (Deno) were not type-checked by anything. - mise/ts.toml `typecheck` fails with a clear message when there is no tsconfig.json. The guard stays when a framework checker (astro check, vue-tsc) replaces `tsc -b`. - It runs `deno check $FOUNDRY_DENO_PATHS` when that is set (deno pinned in [tools]). If git tracks Deno code (supabase/functions/*.ts, deno.json[c]) and the variable is unset, the verb fails instead of silently skipping it. - presets/typecheck/tsconfig.json: a strict, check-only tsconfig covering src, scripts and tests, with notes on extending a framework preset and keeping Deno code out. foundry-init copies it for the ts stack (never clobbering) and flags supabase/functions. - README and FEATURES list the preset and the behaviour.
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.
Summary
Foundry v2 does not make sure a TypeScript project's
typecheckactually covers its TypeScript. It also has no answer for Deno code. tech-atlas hit both:typecheckwasastro checkwith notsconfig.json. That exits 0 after checking only.astrofiles with loose defaults.src/lib/*.ts, the tests andscripts/were never type-checked, and adding a tsconfig exposed 124 errors (build(types): add app/tsconfig.json and fix what it exposes tech-atlas#96).Deno.serve,Deno.env,_shared/modules) were not type-checked by anything (fixed in ci: adopt Foundry v2 (gate + security facades, habit-hooks, deno check) tech-atlas#94 withdeno check).Changes
mise/ts.tomltypechecktsconfig.jsonis missing. (Plaintsc -balready fails, but only with a cryptic TS5083.) The guard is documented to stay when a framework checker replacestsc -b, since that is where the silent pass happens.deno check $FOUNDRY_DENO_PATHSwhen that is set, withdenopinned in[tools]. Both are shown commented out in the template.supabase/functions/*.ts,deno.json[c]) andFOUNDRY_DENO_PATHSis unset, the verb fails instead of leaving that code unchecked.presets/typecheck/tsconfig.json(new): strict and check-only (noEmit). Itsincludecovers src, scripts, tests and root*.ts, with notes on extending a framework's strict preset and on keeping Deno code out.foundry-init.shcopies the preset for thetsstack (never clobbering an existing file) and prints a note whensupabase/functionsexists.These are additive. A consumer that copied the old template is unaffected until it re-syncs. The
gate.ymlfacade needs no change:mise-actioninstallsdenofrom[tools], and the verb runs as before.Verification
I ran the new
typecheckscript (extracted frommise/ts.toml, Git Bash) in a scratch repo:supabase/functions/f/index.ts,FOUNDRY_DENO_PATHSunsetFOUNDRY_DENO_PATHS=supabase/functionsCheck supabase/functions/f/index.ts, exit 0The preset with a type error in
src/makestsc -bexit 1, and exit 0 once the error is fixed.Not changed here:
tsc -bwritestsconfig.tsbuildinfoeven withnoEmit. That was already the template's behaviour; consumers may want it in.gitignore.