-
Notifications
You must be signed in to change notification settings - Fork 179
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
Missing type definitions for PresenceChannel #317
Comments
I don't really see an issue here, sorry. A presence doesn't needs all these methods. They're defined on the base |
Hi @driesvints . Surely the errors exist in TypeScript. The compiled JavaScript code has the methods, but the The following examples are created in this repo: First, it doesn't have a type hint when using TS: It has a Secondly, it cannot be cast to This issue is basically caused by missing type definitions. Please review. |
It's best you attempt a PR if you think anything is broken here 👍 |
Will do |
Description:
First of all, thanks for the great work of the
laravel-echo
package!I've noticed the type definition of
PresenceChannel
is incorrect. (it might be out of date).According to the interface
PresenceChannel
it has only 3 functions:However, the
PusherPresenceChannel
extendsPusherChannel
, which has more functions. e.g.listen
Functionally it's working fine with compiled JavaScript package, but with the
@typescript-eslint
ruleno-unsafe-call
rule turned on, we will get the warning/error (depends on config) messages:And the following error from ts:
Unfortunately, we cannot even cast the type because the types/interfaces do not overlap:
🚑 Hotfix
To who has similar issues and seek a workaround, use double-cast can be a quick way:
Steps To Reproduce:
@typescript-eslint/no-unsafe-call
Echo.join(channelName).listen(() => {});
I am more than happy to submit a PR to fix the interface definitions. Please let me know if the issue I raised is on the right track.
The text was updated successfully, but these errors were encountered: