Skip to content

1.8.1

Compare
Choose a tag to compare
@vitaly-t vitaly-t released this 12 Mar 15:04
· 25 commits to master since this release

Extensions fromEvent, fromEmitter and fromEmitterArgs no longer use strict types. They now expect Event-like and EventEmitter-like types, to support any custom types that implement the minimum of original API.

For example, popular EventEmitter3 now can be used directly, without hard type re-casting.

import {EventEmitter} from "eventemitter3";
import {fromEmitter} from "sub-events/ext";

const e = new EventEmitter(); // our custom emitter

const event = fromEmitter(e, 'receive'); // accepts compatible type without re-casting