chore: Migrate nativeMethods and useAnimatedReaction type tests to TSTyche#9563
Open
MatiPl01 wants to merge 7 commits into
Open
chore: Migrate nativeMethods and useAnimatedReaction type tests to TSTyche#9563MatiPl01 wants to merge 7 commits into
MatiPl01 wants to merge 7 commits into
Conversation
The __typetests__ suites assert types through tsc failures and ~220 `@ts-expect-error` directives, which match any error on the following line and give no per-test reporting. Start migrating them to TSTyche, which runs on the project's own TypeScript and produces named, isolated assertions. - Add the `tstyche` dev dependency and a `type:check:tstyche` script. - Add tstyche.config.json scoped to packages/*/__typetests__. - Convert FeatureFlagTest.tsx to FeatureFlagTest.tst.ts as the first test. - Make scripts/test-ts.sh skip *.tst.* so the old and new harnesses run side by side and files can be migrated one at a time. Builds on the TSTyche proof of concept from #7727.
Co-authored-by: Tom Mrazauskas <tom@mrazauskas.de>
The 7.2.1 bump could not be installed: the repo's 8-day npm age gate quarantines it (published 2026-05-27), and the bump left yarn.lock pinned to 4.1.0, which breaks `yarn install --immutable`. - Add tstyche to npmPreapprovedPackages in .yarnrc.yml. - Update yarn.lock to TSTyche 7.2.1.
TSTyche v7 changed the default configuration file name from tstyche.config.json to tstyche.json. Without the rename v7 auto-renames it at runtime and prints a warning.
CI runs type tests only through each package's `yarn type:check` -> `type:check:tests`, so the standalone `type:check:tstyche` script left the .tst.* tests unenforced now that the old harness skips them. Call `type:check:tstyche`, scoped to the package, from `type:check:tests` so CI keeps checking them. Scoped by package path to avoid cross-package build coupling; worklets stays unwired until it has its first .tst.* test.
Convert two more __typetests__ from `@ts-expect-error`/tsc to TSTyche: - nativeMethods: measure/dispatchCommand/scrollTo accept an Animated ref and reject a plain ref (toBeCallableWith / not.toBeCallableWith); plus setGestureState and the no-argument dispatchCommand form. - useAnimatedReaction: prepare/react callability, the optional dependency array, and the previous-result react parameter. Builds on the TSTyche setup and type:check:tests wiring in #9557.
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
Continues the TSTyche migration (after #9557 / #9562) with two more
__typetests__, both clean callability suites:measure/dispatchCommand/scrollToaccept anuseAnimatedRefand reject a plainuseRef(toBeCallableWith/not.toBeCallableWith), plussetGestureStateand the no-argumentdispatchCommandform.Stacked on #9557 (needs its TSTyche setup +
type:check:testswiring).Test plan
yarn workspace react-native-reanimated type:check:testspasses (old harness + TSTyche).