Skip to content

chore: Migrate nativeMethods and useAnimatedReaction type tests to TSTyche#9563

Open
MatiPl01 wants to merge 7 commits into
mainfrom
@matipl01/tstyche-native-reaction
Open

chore: Migrate nativeMethods and useAnimatedReaction type tests to TSTyche#9563
MatiPl01 wants to merge 7 commits into
mainfrom
@matipl01/tstyche-native-reaction

Conversation

@MatiPl01

Copy link
Copy Markdown
Member

Summary

Continues the TSTyche migration (after #9557 / #9562) with two more __typetests__, both clean callability suites:

  • nativeMethods: measure / dispatchCommand / scrollTo accept an useAnimatedRef and reject a plain useRef (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.

Stacked on #9557 (needs its TSTyche setup + type:check:tests wiring).

Test plan

  • yarn workspace react-native-reanimated type:check:tests passes (old harness + TSTyche).

MatiPl01 and others added 7 commits May 29, 2026 14:51
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.
@MatiPl01 MatiPl01 self-assigned this May 29, 2026
Base automatically changed from @matipl01/typetests-tstyche to main June 10, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant