|
1 | 1 | /* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-floating-promises */ |
2 | 2 | import {expectType, expectError, expectNotAssignable, expectAssignable} from 'tsd'; |
3 | | -import {pEvent} from 'p-event'; |
| 3 | +import {pEventIterator} from 'p-event'; |
4 | 4 | import Emittery from './index.js'; |
5 | 5 |
|
6 | 6 | type AnyListener = (eventData?: unknown) => void | Promise<void>; |
@@ -254,26 +254,26 @@ type AnyListener = (eventData?: unknown) => void | Promise<void>; |
254 | 254 | }; |
255 | 255 | } |
256 | 256 |
|
257 | | -// TODO: Fix type compatibility with `p-event`. |
258 | 257 | // 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 | +} |
265 | 264 |
|
266 | 265 | // 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 | +} |
277 | 277 |
|
278 | 278 | // Mixin type |
279 | 279 | Emittery.mixin('emittery')(class { |
|
0 commit comments