Commit eaaab30
authored
Remove deprecated
## Summary
Remove the `import type { ReactTestInstance } from
'react-test-renderer'` from `jestUtils/index.ts` and replace the
parameter with a minimal structural type.
`react-test-renderer` is [deprecated in React
19](https://react.dev/warnings/react-test-renderer), and
`@testing-library/react-native` v14 [replaces
it](https://oss.callstack.com/react-native-testing-library/14.x/docs/start/migration-v14)
with the new
[`test-renderer`](https://github.com/mdjastrzebski/test-renderer)
package (and its `TestInstance` type). The `ReactTestInstance` type was
only used as the `getAnimatedStyle` parameter, which immediately casts
it away via `as unknown as TestComponent` — making it purely decorative.
The structural replacement `{ props: Record<string, unknown> }` is
compatible with both `ReactTestInstance` (RNTL v13) and `TestInstance`
(RNTL v14) via TypeScript's structural typing — I verified both compile
cleanly. No consumer code changes needed.
**Before:** Published `jestUtils/index.d.ts` imports from
`react-test-renderer`, which isn't in `dependencies` — breaks consumers
with `skipLibCheck: false`.
**After:** No external type import in `jestUtils`. Works for all
consumers regardless of `skipLibCheck` setting.
## Test plan
**Structural type compatibility** — tested with both `ReactTestInstance`
(`@types/react-test-renderer@19.1.0`) and `TestInstance`
(`test-renderer@0.15.0`). Both accepted by the structural type. Invalid
inputs (missing `props`, wrong type, `null`) correctly rejected.
**Consumer reproduction** — patched the published
`lib/typescript/jestUtils/index.d.ts` in a consumer project with
`skipLibCheck: false` and no `@types/react-test-renderer` installed.
Before: `TS2307: Cannot find module 'react-test-renderer'`. After: gone.
**Upstream quality gates:**
```
yarn workspace react-native-reanimated type:check:src:native
```
Zero regressions (same pre-existing `react-native-worklets` errors
only).react-test-renderer type from published declarations (#9055)1 parent 24241cc commit eaaab30
1 file changed
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
347 | 346 | | |
348 | 347 | | |
349 | 348 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
356 | 353 | | |
357 | 354 | | |
358 | 355 | | |
0 commit comments