Repository navigation
Commit 404c091
authored
Keep the pointerEvents ts-expect-error in emitted spec declarations (#4601)
## Description
The three codegen specs redeclare `pointerEvents` as `WithDefault<...,
'auto'>`, which codegen requires. `WithDefault` adds `null`, so the
interface no longer satisfies `ViewProps.pointerEvents`, and the source
suppresses that with a `// @ts-expect-error` (or `// @ts-ignore`) line.
Declaration emit drops line comments, so the published
`lib/typescript/specs/*.d.ts` carry a bare TS2430. Any consumer with
`skipLibCheck: false` fails to type-check:
error TS2430: Interface 'NativeProps' incorrectly extends interface
'ViewProps'. Types of property 'pointerEvents' are incompatible.
This turns the directives into `/** */` block comments. TypeScript
honours directives in block comments, and JSDoc survives declaration
emit, so the suppression now ships with the types. Codegen can't do this
itself: `extends Omit<ViewProps, 'pointerEvents'>` fails with "Unable to
handle prop spread: Omit" and dropping `WithDefault` fails with "A
default enum value is required".
## Test plan
- `yarn ts-check` and `yarn lint:js` in the package
- Codegen schema (`combine-js-to-schema-cli`, iOS and Android) identical
before and after
- `yarn build`, then installed the packed tarball into a fresh RN 0.87
app with `skipLibCheck: false`: the two RNGH TS2430 errors are gone,
only RN's own typing errors remain
- Same check against RN 0.88 declarations1 parent fe86f59 commit 404c091
3 files changed
Lines changed: 3 additions & 3 deletions
File tree
- packages/react-native-gesture-handler/src/specs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments