Convert additional Props/Style types to interface - #58062
Open
huntie wants to merge 1 commit into
Open
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
huntie
force-pushed
the
fix-definitely-typed-interfaces
branch
from
August 21, 2026 14:58
c359385 to
57b788f
Compare
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.
Summary
In response to this comment: #57490 (comment)
The DefinitelyTyped
react-native-webtypes augment thereact-nativemodule to layer web-only props and style values onto React Native's types. Module augmentation only works againstinterfacedeclarations, so these hiterror TS2300: Duplicate identifier.This was solved in #56809 — this diff extends
interfaceemission to additional types as below.Changes
Annotate the remaining types that
@types/react-native-webaugments with@build-types emit-as-interface:AccessibilityPropsImagePropsPressableStateCallbackTypeViewStyle,TextStyle,ImageStyleSource for matched
@types/react-native-webconflicts@types/react-native-webAccessibilityPropsLibraries/Components/View/ViewAccessibility.js:342ImagePropsLibraries/Image/ImageProps.js:336PressableStateCallbackTypeLibraries/Components/Pressable/Pressable.js:36ViewStyleLibraries/StyleSheet/StyleSheet.js.flow:141TextStyleLibraries/StyleSheet/StyleSheet.js.flow:159ImageStyleLibraries/StyleSheet/StyleSheet.js.flow:177Not fixed
The remaining DT failures (parsed from https://github.com/DefinitelyTyped/DefinitelyTyped/actions/runs/32138113480) aren't interface issues:
InteractionManagerhas no export in the Strict API at all.VirtualizedListPropsis genuinely non-generic in the Flow source (packages/virtualized-lists/Lists/VirtualizedListProps.js:287), andgetItem/getItemCountare required there. DT'sVirtualizedListProps<ItemT>with those omitted is an assumption carried over from the old hand-written types.ViewStyle/TextStyle/ImageStyle"incorrectly extendsWebStyle" errors will persist. RN'sDimensionValueincludesnull, and DT redefinesbottom?: CSSProperties["bottom"] | DimensionValueon an interface extendingWebStyle, whosebottomdoes not acceptnull. DT needsExclude<DimensionValue, null>there. Expect 3 of the 16 reported errors to remain once the duplicate-identifier ones clear.cc @jakebailey
Changelog:
[General][Fixed] - JS API: Additional Props/Style types are now defined as
interface, fixing compatibility with certain DefinitelyTyped packagesTest Plan
node ./scripts/js-api/build-types— snapshot regenerated;--validatepassesyarn test-generated-typescript,yarn test-typescript— passyarn jest scripts/js-api— 141 tests passtypes_generated: all six now merge cleanly. As a control, augmentingImagePropsAndroid(still a type alias) in the same harness reproduceserror TS2300: Duplicate identifier, confirming the harness detects the failure mode.