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

Update type definitions #219

Merged
merged 2 commits into from
May 10, 2020
Merged

Update type definitions #219

merged 2 commits into from
May 10, 2020

Conversation

gfmio
Copy link
Contributor

@gfmio gfmio commented Mar 31, 2020

This PR adds a new set of type definitions to this library, as outlined in issue #217.

Right now, if the type parameter is a map of events and parameter array types, the parameters themselves don't get human-readable names. If the event map type instead supported using entire function annotations, the parameter names could be retained which makes using the library easier.

Before the changes in this PR, you could only do the following:

Screenshot 2020-03-02 at 14 46 23

With the changes in this PR, you could do this:

Screenshot 2020-03-02 at 14 40 12

Additionally, the PR adds an optional type parameter for the context object.

@gfmio
Copy link
Contributor Author

gfmio commented Apr 29, 2020

@lpinca, when you have time, can you please take a look at this PR?

@lpinca
Copy link
Member

lpinca commented Apr 30, 2020

I'm not qualified to review this PR as I don't use TypeScript.

cc: @delta62

@lpinca
Copy link
Member

lpinca commented May 10, 2020

@gfmio is this a breaking change or can it cause issues if released as a patch release?

@gfmio
Copy link
Contributor Author

gfmio commented May 10, 2020

@gfmio is this a breaking change or can it cause issues if released as a patch release?

No, this won't break anything, so it can be released as a patch.

The ListenerFn type is now unused, but I didn't precisely because it's I didn't want to break the API surface.

@lpinca
Copy link
Member

lpinca commented May 10, 2020

Ok. I'll merge it then.

@lpinca lpinca merged commit e84ca51 into primus:master May 10, 2020
@lpinca
Copy link
Member

lpinca commented May 10, 2020

Thank you.

@gfmio
Copy link
Contributor Author

gfmio commented May 10, 2020

Thanks a lot, @lpinca!

@tjenkinson
Copy link

Haven’t looked in detail yet but FYI looks like this breaks hlsjs. See video-dev/hls.js#2718

@teazean
Copy link

teazean commented May 11, 2020

Haven’t looked in detail yet but FYI looks like this breaks hlsjs. See video-dev/hls.js#2718

+1

@lpinca
Copy link
Member

lpinca commented May 11, 2020

Can you provide a backward compatible patch? Otherwise I will revert it.

@lpinca
Copy link
Member

lpinca commented May 11, 2020

It seems the issue with hls.js has been addressed in video-dev/hls.js@48db1a5.

@gfmio
Copy link
Contributor Author

gfmio commented May 11, 2020

@lpinca Having a look now

@gfmio
Copy link
Contributor Author

gfmio commented May 11, 2020

@tjenkinson @teazean @lpinca I've reproduced the error. The typings on the default export are correct, but not on the named export.

I will file a new PR to patch this. Thanks for reporting.

@tjenkinson
Copy link

Great thanks!

@gfmio
Copy link
Contributor Author

gfmio commented May 11, 2020

@tjenkinson Can you verify that 4.0.3 fixes all issues for you?

@tjenkinson
Copy link

@gfmio 4.0.3 works fine again without needing extends EventEmitter<any> thanks!

@teazean
Copy link

teazean commented May 12, 2020

thanks, 4.0.3 works fine.

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.

4 participants