Repository navigation
feat(evals): consolidate tsconfig setup and typecheck every eval in its own isolated TS program - #389
Open
mikolajadamowicz wants to merge 1 commit into
Open
mikolajadamowicz wants to merge 1 commit into
mikolajadamowicz wants to merge 1 commit into
Conversation
Author
|
|
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.
Why
bun run typecheckonly ever checkedrunner/. The roottsconfig.jsonlistedevals/ininclude, but also excluded it, so every eval fixture (app/,example/,reference/) had no typecheck gate at all, and CI never caught a broken eval.The obvious fix, one shared
tscprogram over all ofevals/, doesn't work. Several evals declare global type augmentations (react-navigation'sdeclare global { namespace ReactNavigation { interface RootParamList ... } } }is the common one). Compiling every eval into the same program merges those interfaces across unrelated evals and produces false conflicts, most visibly across 17 files innavigation/*, where each eval extendsRootParamListwith a different, incompatible shape.What changed
scripts/typecheck-evals.ts: new script that gives every eval directory its own isolated TypeScript program (via the compiler API), so global augmentations from one eval never leak into another. All programs share one compiler host, so common files like React Native's types andlib.d.tsare parsed once instead of once per eval. Run withbun run typecheck:evals.evals/tsconfig.json: now the single source of eval compiler options, extended by nothing else. Also carries the one real exception this repo needs:expo-router/01-rn-expo-router-sdk56-react-navigation-imports/app/_layout.tsxintentionally imports legacy@react-navigation/nativetheming (that's the eval's premise), which conflicts with expo-router's vendored theming types when compiled alongside that eval's ownreference/. The file is excluded with a comment explaining why.evals/tsconfig.expo.jsonand thetypecheck:expo-evalsscript. They existed to give the three Expo categories a shared-program check that dodged the same collision problem for one file.typecheck:evalsalready covers those same evals per-fixture, without the collision risk, so the separate config was redundant.tsconfig.json: addedscripts/**/*.tstoincludeso the new script is itself covered bybun run typecheck.evals/async-state/12-rn-jotai-atomwithstorage-async-rehydrate-guard/app/App.tsxreadprevious.themedirectly insideatomWithStorage's setter, butpreviousthere is typedPreferences | Promise<Preferences>. Now awaits it first, matching the pattern the eval's ownreference/already uses.Known gap
25 skia evals still fail
typecheck:evals, all with the same error:@shopify/react-native-skiaisn't installed anywhere in the repo, so its types can't resolve.This depends on #388 (#388), which adds
@shopify/react-native-skiaas a dependency and fixes four real bugs in skia reference solutions that the missing dependency had been hiding. That PR needs to merge first, ortypecheck:evalskeeps failing on all 25 skia evals here.#388 was built against the old single-shared-program
evals/tsconfig.json(it verifies withbun tsc -p evals/tsconfig.json --noEmit), before this PR'sinclude/excludechanges and the move to per-eval isolation. Whichever PR merges second will likely need a small rebase onevals/tsconfig.jsonto reconcile the two.Testing
bun run typecheck:evals: 109/134 evals pass. The 25 failures are exactly the skia evals above, nothing else.bun run typecheck: clean.bun run lint: clean.