Skip to content

Commit 2eea7f7

Browse files
authored
Fix compatibility with p-event (#115)
1 parent 253f457 commit 2eea7f7

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

index.test-d.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-floating-promises */
22
import {expectType, expectError, expectNotAssignable, expectAssignable} from 'tsd';
3-
import {pEvent} from 'p-event';
3+
import {pEventIterator} from 'p-event';
44
import Emittery from './index.js';
55

66
type AnyListener = (eventData?: unknown) => void | Promise<void>;
@@ -254,26 +254,26 @@ type AnyListener = (eventData?: unknown) => void | Promise<void>;
254254
};
255255
}
256256

257-
// TODO: Fix type compatibility with `p-event`.
258257
// Compatibility with p-event, without explicit types
259-
// {
260-
// const ee = new Emittery();
261-
// pEvent.iterator(ee, 'data', {
262-
// resolutionEvents: ['finish']
263-
// });
264-
// }
258+
{
259+
const ee = new Emittery();
260+
pEventIterator(ee, 'data', {
261+
resolutionEvents: ['finish'],
262+
});
263+
}
265264

266265
// Compatibility with p-event, with explicit types
267-
// {
268-
// const ee = new Emittery<{
269-
// data: unknown;
270-
// error: unknown;
271-
// finish: undefined;
272-
// }>();
273-
// pEvent.iterator(ee, 'data', {
274-
// resolutionEvents: ['finish']
275-
// });
276-
// }
266+
{
267+
type EventData = {
268+
data: unknown;
269+
error: unknown;
270+
finish: undefined;
271+
};
272+
const ee = new Emittery<EventData>();
273+
pEventIterator<keyof EventData, unknown>(ee, 'data', {
274+
resolutionEvents: ['finish'],
275+
});
276+
}
277277

278278
// Mixin type
279279
Emittery.mixin('emittery')(class {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"ava": "^4.3.3",
5858
"delay": "^5.0.0",
5959
"nyc": "^15.1.0",
60-
"p-event": "^5.0.1",
60+
"p-event": "^6.0.0",
6161
"tsd": "^0.23.0",
6262
"xo": "^0.55.0"
6363
},

0 commit comments

Comments
 (0)