Package to replace
typed-emitter
Suggested replacement(s)
native EventEmitter<T>
Manifest type
native (replaceable by a built-in platform feature)
Rationale
Example from typed-emitter README:
import EventEmitter from "events"
import TypedEmitter from "typed-emitter"
type MessageEvents = {
error: (error: Error) => void,
message: (body: string, from: string) => void
};
const messageEmitter = new EventEmitter() as TypedEmitter<MessageEvents>;
This can instead be:
import EventEmitter from "events";
type MessageEvents = {
error: [error: Error],
message: [body: string, from: string]
};
const messageEmitter = new EventEmitter<MessageEvents>;
Availability
It was added to @types/node in 2024.
Code example (optional)
Package to replace
typed-emitter
Suggested replacement(s)
native
EventEmitter<T>Manifest type
native (replaceable by a built-in platform feature)
Rationale
Example from typed-emitter README:
This can instead be:
Availability
It was added to
@types/nodein 2024.Code example (optional)