chore: Migrate value, misc, and style-augmentation type tests to TSTyche#9565
Open
MatiPl01 wants to merge 12 commits into
Open
chore: Migrate value, misc, and style-augmentation type tests to TSTyche#9565MatiPl01 wants to merge 12 commits into
MatiPl01 wants to merge 12 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.
- useSharedValue: read/write/compound-assignment/set/get/modify compile-checks. - useDerivedValue: readonly `.value` via a message-matched `@ts-expect-error`; the deprecated `.set` stays a compile-check. - misc: makeMutable/isSharedValue/interpolateColor/Easing callability, Keyframe constructability, and the adapter rejection on useAnimatedStyle.
Convert the AnimatedStyle augmentation regression suite (coverage for #9328) from tsc to TSTyche. These are contextual-assignment compile checks - each `const s: AnimatedStyle<...> = { ... }` must type-check - so they stay as typed assignments inside `test()` blocks, which TSTyche validates by type-checking the file. `toBeAssignableTo` is unsuitable here: it infers the object literal standalone and widens its string literals (e.g. `'allow-discrete'` -> `string`), which would wrongly reject the augmented-style cases. Builds on the TSTyche setup and type:check:tests wiring in #9557.
Strengthen the useSharedValue/useDerivedValue tests with explicit TSTyche assertions rather than relying on compile-only checks: - useSharedValue: `toBe<SharedValue<T>>` on the hook return, `toBe<number>` on `.value`/`.get()`, `toBeCallableWith` on `.set`/`.modify`, plus a writability compile-check (no matcher exists for "writable"). - useDerivedValue: `toBe<DerivedValue<number>>` on the return and `toBe<number>` on `.value`, keeping the message-matched readonly `@ts-expect-error`.
mrazauskas
reviewed
May 30, 2026
…Test.tst.ts Co-authored-by: Tom Mrazauskas <tom@mrazauskas.de>
…Test.tst.ts Co-authored-by: Tom Mrazauskas <tom@mrazauskas.de>
oxfmt 0.45.0 wraps a multi-line generic type argument differently on its linux (CI) and darwin bindings, so CI flagged useDerivedValueTest formatting that passed locally. Bind the hook results to a const so each `toBe<...>()` fits on one line - no wrap, so it formats identically across platforms.
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.
Migrates
useSharedValue,useDerivedValue,misc, andanimatedStyleAugmentation__typetests__to TSTyche. Stacked on #9557.useDerivedValue's readonly check uses a message-matched@ts-expect-error.