Repository navigation
Open
Description
Description
Importing react-native from a project that type-checks its dependencies' declarations (skipLibCheck: false) fails with three errors inside types_generated, the declarations the package's exports point at. Each comes from a translation of the Flow source that TypeScript reads differently:
Libraries/Animated/nodes/AnimatedProps.d.ts:AnimatedPropsAllowlisthasstyle?: AnimatedStyleAllowlist | undefinedbeside the index signature[key: string]: true | AnimatedStyleAllowlist. The optional property'sundefinedis outside the index signature's type, so TypeScript reports TS2411. The Flow source (AnimatedProps.jsL28-L31) writesstyle?: ?AnimatedStyleAllowlist.Libraries/Lists/VirtualizedList.d.ts:VirtualizedListInstance = React.ComponentRef<VirtualizedListType>, translated fromReact.ElementRef<VirtualizedListType>(VirtualizedList.jsL20).@types/react'sComponentRefrequires anElementType, and theVirtualizedListclass is not one, since itsgetDerivedStateFromPropstakesVirtualizedListPropswhereComponentClass<any>passesReadonly<any>(TS2344).src/private/webapis/dom/nodes/ReactNativeDocument.d.ts:ReactNativeDocumentoverridestextContentwith typenull(ReactNativeDocument.jsL78), whileReadOnlyNodedeclaresget textContent(): string(ReadOnlyNode.jsL188). Flow accepts the override; TypeScript reports TS2416.
Steps to reproduce
- Clone https://github.com/YevheniiKotyrlo/react-native-typescript-declarations and run
yarn installinReproducerApp. It runsreact-native@0.89.0-nightly-20261029-25b05acd7with TypeScript 7.0.2 and@types/react19.3.0. - Run
yarn check:declarations. It type-checksdeclarations/import-react-native.ts, which isimport {View} from 'react-native', withstrict: true,skipLibCheck: false,lib: ["ES2024"]andtypes: [].
Expected: no errors.
Seen: the three errors below. 0.88.1 prints the same three.
React Native Version
0.88.1, and 0.89.0-nightly-20261029-25b05acd7
Affected Platforms
Other (please specify)
Output of npx @react-native-community/cli info
System:
OS: Windows 11 10.0.26300
Binaries:
Node:
version: 26.12.1
Yarn:
version: 1.22.22
npmPackages:
"@react-native-community/cli":
installed: 20.2.0
wanted: 20.2.0
react:
installed: 19.3.0
wanted: 19.3.0
react-native:
installed: 0.89.0-nightly-20261029-25b05acd7
wanted: 0.89.0-nightly-20261029-25b05acd7
The defect is in the published TypeScript declarations, so it shows on every platform; the reproducer only runs tsc.
Stacktrace or Logs
node_modules/react-native/types_generated/Libraries/Animated/nodes/AnimatedProps.d.ts(19,3): error TS2411: Property 'style' of type 'Readonly<{ [$$Key$$: string]: true; }> | undefined' is not assignable to 'string' index type 'true | Readonly<{ [$$Key$$: string]: true; }>'.
node_modules/react-native/types_generated/Libraries/Lists/VirtualizedList.d.ts(17,58): error TS2344: Type 'typeof VirtualizedList' does not satisfy the constraint 'ElementType<any, keyof IntrinsicElements>'.
Type 'typeof VirtualizedList' is not assignable to type 'ComponentClass<any, any>'.
Types of property 'getDerivedStateFromProps' are incompatible.
Type '(newProps: VirtualizedListProps, prevState: State) => State' is not assignable to type 'GetDerivedStateFromProps<any, any>'.
Types of parameters 'newProps' and 'nextProps' are incompatible.
Type 'Readonly<any>' is not assignable to type 'VirtualizedListProps'.
Type 'Readonly<any>' is missing the following properties from type 'Omit<RequiredVirtualizedListProps, keyof OptionalVirtualizedListProps>': getItem, getItemCount
node_modules/react-native/types_generated/src/private/webapis/dom/nodes/ReactNativeDocument.d.ts(29,7): error TS2416: Property 'textContent' in type 'ReactNativeDocument' is not assignable to the same property in base type 'ReadOnlyNode'.
Type 'null' is not assignable to type 'string'.
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-typescript-declarations
Screenshots and Videos
None: the failure is the type checker's output above.
Metadata
Metadata
Assignees
Labels
No labels
Activity
YevheniiKotyrlo commentedon Oct 30, 2026
This is the patch I apply to the published 0.88.0 package until a fix lands: it widens the index signature with
| undefined, writesInstanceType<VirtualizedListType>, and widensReadOnlyNode's getter tostring | null, which clears all three errors underskipLibCheck: false.