fix: [TS] Sync .d.ts exports with runtime from .js files#56533
Closed
retyui wants to merge 1 commit into
Closed
Conversation
08916dc to
dccde7f
Compare
dccde7f to
d427f09
Compare
d427f09 to
aade909
Compare
aade909 to
c13eacc
Compare
Contributor
Author
|
@huntie could you please review this PR ? |
huntie
suggested changes
May 11, 2026
Member
There was a problem hiding this comment.
🚫 This is a wide-spanning breaking change to a legacy types system we want to leave (mostly) untouched. Its replacement will be the Strict TypeScript API in the near future, which already aligns all TS types with Flow source.
Problems with this change
- Touches multiple API exports across individual type definitions, that will break importers of these inner modules (even though we want to eliminate subpath imports soon, so this is unwanted churn).
- In
index.d.ts, eachexport * from '../Libraries/...';already present makes the addedexport {default as ...} from ...additions redundant — these were already accessible.
The big picture
The Strict TypeScript API is already our incoming version of (effectively) these changes.
- Subpath imports become inaccessible.
- Code is generated 1:1 from Flow types source.
Any misalignments that existed in these manual .d.ts types from before are unfortunately part of the public API that people know and depend on already. Our intended switchover to the above constraints is a planned per-project opt-in via "react-native-strict-api".
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:
I want this codebase to have strict TS types sync with JS impl.
I went through each exported getter in entry point file
packages/react-native/index.jsand make sure that exported JS implementation exist on TypeScript side (in
.d.ts.files)Added missing types (with tests)
Example of bad types:
P.S. I found that these exported items are still missing typescript types:
Changelog:
[GENERAL] [BREAKING] - Make typescript exports in
.d.tssync with real implementation in.jsfilesTest Plan: