Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typings compatibility with p-event #72

Closed
wants to merge 2 commits into from
Closed

Fix typings compatibility with p-event #72

wants to merge 2 commits into from

Conversation

papb
Copy link
Contributor

@papb papb commented Dec 30, 2020

With the release of 0.8.0, the following no longer type-checks:

import pEvent = require('p-event');

const ee = new Emittery();
pEvent.iterator(ee, 'data', {
	resolutionEvents: ['finish']
});

This PR fixes this.

@sindresorhus
Copy link
Owner

// @airhorns

@airhorns
Copy link
Contributor

If I understand correctly, this issue arises because TypeScript can't assign an Emittery to the p-event.Emitter type before this change, and it can't do that because neither overloaded on/off function cover the event name type all together, despite them covering it when put together?

@papb
Copy link
Contributor Author

papb commented Dec 30, 2020

Hi @airhorns, thank you for taking a look, to be honest I was in such a hurry that I didn't check exactly what was the reason for it to not be working; I am not sure if it is just a TypeScript limitation. I happened to figure out this fix by luck, I agree with you that the previous overloads seem equivalent to what I did now.

@papb
Copy link
Contributor Author

papb commented Jan 2, 2021

Replaced by #73

@papb papb closed this Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants