You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Public property 'events' of exported class has or is using name 'Emitter' from external module "/path/to/node_modules/nanoevents/index" but cannot be named
The fix would be to update the index.d.ts file for the project to look like this. This works because when setting export = createNanoEvents then we also have to wrap everything in a namespace so that it can be accessed by external code.
declarenamespacecreateNanoEvents{interfaceEventsMap{[event: string]: any}interfaceDefaultEventsextendsEventsMap{[event: string]: (...args: any)=>void}classEmitter<EventsextendsEventsMap>{/** * Event names in keys and arrays with listeners in values. * * ```js * emitter1.events = emitter2.events * emitter2.events = { } * ``` */events: Partial<{[EinkeyofEvents]: Events[E][]}>/** * Add a listener for a given event. * * ```js * const unbind = ee.on('tick', (tickType, tickDuration) => { * count += 1 * }) * * disable () { * unbind() * } * ``` * * @param event The event name. * @param cb The listener function. * @returns Unbind listener from event. */on<KextendskeyofEvents>(this: this,event: K,cb: Events[K]): ()=>void/** * Calls each of the listeners registered for a given event. * * ```js * ee.emit('tick', tickType, tickDuration) * ``` * * @param event The event name. * @param args The arguments for listeners. */emit<KextendskeyofEvents>(this: this,event: K,
...args: Parameters<Events[K]>): void}}/** * Create event emitter. * * ```js * import createNanoEvents from 'nanoevents' * * class Ticker { * constructor() { * this.emitter = createNanoEvents() * } * on(...args) { * return this.emitter.on(...args) * } * tick() { * this.emitter.emit('tick') * } * } * ``` */declarefunctioncreateNanoEvents<EventsextendscreateNanoEvents.EventsMap=createNanoEvents.DefaultEvents>(): createNanoEvents.Emitter<Events>export=createNanoEvents
The text was updated successfully, but these errors were encountered:
Description
The error is shown below.
The fix would be to update the index.d.ts file for the project to look like this. This works because when setting
export = createNanoEvents
then we also have to wrap everything in a namespace so that it can be accessed by external code.The text was updated successfully, but these errors were encountered: