From 4acef8e4a4d1ec51eeea751c7ee6aa36d8b7f457 Mon Sep 17 00:00:00 2001 From: Helena Ford Date: Thu, 16 Mar 2023 06:04:51 -0700 Subject: [PATCH] fix: EventEmitter ts definition file (#36462) 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 Pull Request resolved: https://github.com/facebook/react-native/pull/36462 Reviewed By: cipolleschi Differential Revision: D44130846 Pulled By: javache fbshipit-source-id: 64cecdf55e58b99b243392811226e5095d5dc006 --- Libraries/Components/TextInput/TextInput.d.ts | 2 +- Libraries/EventEmitter/NativeEventEmitter.d.ts | 3 +-- Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts | 3 +-- Libraries/vendor/emitter/EventEmitter.d.ts | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Libraries/Components/TextInput/TextInput.d.ts b/Libraries/Components/TextInput/TextInput.d.ts index 637807aafd3864..80e8df0c03daca 100644 --- a/Libraries/Components/TextInput/TextInput.d.ts +++ b/Libraries/Components/TextInput/TextInput.d.ts @@ -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'; diff --git a/Libraries/EventEmitter/NativeEventEmitter.d.ts b/Libraries/EventEmitter/NativeEventEmitter.d.ts index c9f30d0cceb41e..911d0a7ca8a7f8 100644 --- a/Libraries/EventEmitter/NativeEventEmitter.d.ts +++ b/Libraries/EventEmitter/NativeEventEmitter.d.ts @@ -7,9 +7,8 @@ * @format */ -import { +import EventEmitter, { EmitterSubscription, - EventEmitter, } from '../vendor/emitter/EventEmitter'; /** diff --git a/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts b/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts index 1e92935b9b5b12..7c5563bac35a85 100644 --- a/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts +++ b/Libraries/EventEmitter/RCTDeviceEventEmitter.d.ts @@ -7,9 +7,8 @@ * @format */ -import { +import EventEmitter, { EmitterSubscription, - EventEmitter, EventSubscriptionVendor, } from '../vendor/emitter/EventEmitter'; diff --git a/Libraries/vendor/emitter/EventEmitter.d.ts b/Libraries/vendor/emitter/EventEmitter.d.ts index 297b89e8a459ac..148bff33d0a868 100644 --- a/Libraries/vendor/emitter/EventEmitter.d.ts +++ b/Libraries/vendor/emitter/EventEmitter.d.ts @@ -104,7 +104,7 @@ interface EmitterSubscription extends EventSubscription { remove(): void; } -export declare class EventEmitter { +export default class EventEmitter { /** * * @param subscriber - Optional subscriber instance