Hide runtime-managed class constructors from public API (#57028)#57028
Closed
huntie wants to merge 1 commit into
Closed
Hide runtime-managed class constructors from public API (#57028)#57028huntie wants to merge 1 commit into
huntie wants to merge 1 commit into
Conversation
|
@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107119545. |
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 1, 2026
Summary: Mark `ReactNativeElement` as non-user-constructible in the generated TypeScript definitions by selectively stripping the constructor on this type. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types omit-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 1, 2026
Summary: Mark `ReactNativeElement` as non-user-constructible in the generated TypeScript definitions by selectively stripping the constructor on this type. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types omit-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types private-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types private-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types private-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
92c19e9 to
01bfa84
Compare
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types protected-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types protected-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types protected-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
huntie
added a commit
to huntie/react-native
that referenced
this pull request
Jun 2, 2026
Summary: Mark `ReactNativeElement` and `ReadOnlyNode` as non-user-constructible in the generated TypeScript definitions by emitting `protected constructor()`. **Motivation** - Correctness — like web DOM elements (`HTMLElement`, etc.), `ReactNativeElement` instances are created by the React Native runtime, not in user space. See also D107227212. - Reduce public API surface (in particular, since this is also aliased to the `HostInstance` type). **Changes** - Adds a new `build-types protected-constructor` directive and corresponding `build-types` post-transform. - Applies directive to `ReactNativeElement` and `ReadOnlyNode`. - Also extracts shared `build-types` directive helpers into `transforms/typescript/utils/buildDirectives.js`. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D107119545
|
This pull request has been merged in d566838. |
Collaborator
|
This pull request was successfully merged by @huntie in d566838 When will my fix make it into a release? | How to file a pick request? |
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:
Mark
ReactNativeElementandReadOnlyNodeas non-user-constructible in the generated TypeScript definitions by emittingprotected constructor().Motivation
HTMLElement, etc.),ReactNativeElementinstances are created by the React Native runtime, not in user space. See also D107227212.HostInstancetype).Changes
build-types protected-constructordirective and correspondingbuild-typespost-transform.ReactNativeElementandReadOnlyNode.build-typesdirective helpers intotransforms/typescript/utils/buildDirectives.js.Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D107119545