Skip to content

Commit

Permalink
fix: EventEmitter ts definition file (#36462)
Browse files Browse the repository at this point in the history
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: #36462

Reviewed By: cipolleschi

Differential Revision: D44130846

Pulled By: javache

fbshipit-source-id: 64cecdf55e58b99b243392811226e5095d5dc006
  • Loading branch information
helenaford authored and facebook-github-bot committed Mar 16, 2023
1 parent 681d7f8 commit 4acef8e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Libraries/Components/TextInput/TextInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
NativeTouchEvent,
TargetedEvent,
} from '../../Types/CoreEventTypes';
import {EventEmitter} from '../../vendor/emitter/EventEmitter';
import EventEmitter from '../../vendor/emitter/EventEmitter';
import {AccessibilityProps} from '../View/ViewAccessibility';
import {ViewProps} from '../View/ViewPropTypes';

Expand Down
3 changes: 1 addition & 2 deletions Libraries/EventEmitter/NativeEventEmitter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
* @format
*/

import {
import EventEmitter, {
EmitterSubscription,
EventEmitter,
} from '../vendor/emitter/EventEmitter';

/**
Expand Down
3 changes: 1 addition & 2 deletions Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
* @format
*/

import {
import EventEmitter, {
EmitterSubscription,
EventEmitter,
EventSubscriptionVendor,
} from '../vendor/emitter/EventEmitter';

Expand Down
2 changes: 1 addition & 1 deletion Libraries/vendor/emitter/EventEmitter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ interface EmitterSubscription extends EventSubscription {
remove(): void;
}

export declare class EventEmitter {
export default class EventEmitter {
/**
*
* @param subscriber - Optional subscriber instance
Expand Down

0 comments on commit 4acef8e

Please sign in to comment.