-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: EventEmitter ts definition file #36462
fix: EventEmitter ts definition file #36462
Conversation
Base commit: 803bb16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From #36109 it seemed like we shouldn't be exposing EventEmitter
at all, since we do not export it as part of our entrypoint for public APIs.
Are you seeing this error when trying to import this as a source file from RN directly by chance?
@NickGerleman ah interesting. We use it in notifee. not sure what the alternative would be to use 🙁 However, either way, the ts definition file is wrong, even if it's for internal use only. This change doesn't change how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is an improvement that the type lines up.
For more context, many of the existing types do not line up internal to the public export, as an artifact of the current types being split from a flat file.
I.e. most of the files have it describing the interface as exported by RN, directly re-exported, vs the type being correct internally, and the re-exporting done at a higher layer. But that’s more an unfortunate historical artifact instead of the ideal.
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: There's an error in the `d.ts` file for EventEmitter which causes the following error: ``` This expression is not constructable. Type 'typeof import(".../vendor/emitter/EventEmitter")' has no construct signatures. const emitter = new EventEmitter(); ~~~~~~~~~~~~ ``` See https://github.com/facebook/react-native/blob/dce9d8d5de381fe53760ddda0d6cbbdfb5be00e4/Libraries/vendor/emitter/EventEmitter.js#L63 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [GENERAL] [FIXED] -Fixes an issue with the EventEmitter type definition file For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Pull Request resolved: facebook#36462 Reviewed By: cipolleschi Differential Revision: D44130846 Pulled By: javache fbshipit-source-id: 64cecdf55e58b99b243392811226e5095d5dc006
Summary
There's an error in the
d.ts
file for EventEmitter which causes the following error:See
react-native/Libraries/vendor/emitter/EventEmitter.js
Line 63 in dce9d8d
Changelog
Test Plan