Typescript: listen property does not exist on type 'Presence Channel'
See original GitHub issueI use laravel echo with Typescript and I have a problem on listen property, I receive a
TS2339: Property ‘listen’ does not exist on type ‘PresenceChannel’.
In this segment of code:
echo.join(channel)
.here((users) => {
EventBusMain.$emit(EVENTS.HERE_MAIN_CHANNEL_EVENT, {users});
})
.joining((user) => {
EventBusMain.$emit(EVENTS.JOIN_MAIN_CHANNEL_EVENT, {user});
})
.leaving((user) => {
EventBusMain.$emit(EVENTS.LEAVE_MAIN_CHANNEL_EVENT, {user});
})
.listen('.event', (e) => {
EventBusMain.$emit(e.event, e.data)
});
The version of laravel echo I’m using is 1.5.4
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (7 by maintainers)
Top Results From Across the Web
Angular - How to fix 'property does not exist on type' error?
It usually happens when you develop Angular applications. To solve this just shut down the server & start it again: $ ng serve....
Read more >Release Notes | Supabase
RealtimeSubscription class no longer exists and replaced by RealtimeChannel . RealtimeClient 's disconnect method now returns type of void . It used to...
Read more >Broadcasting - Laravel - The PHP Framework For Web Artisans
Laravel Echo is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting...
Read more >Node.js v19.3.0 Documentation
If the values do not match, or if the string argument is of another type than string , an AssertionError is thrown with...
Read more >Notifications - Expo Documentation
The plugin allows you to configure various properties that cannot be set ... This prompt will not appear until at least one notification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@willypuzzle @driesvints @Mathem8tic @ellisio @JeffreyWay
I found a solution that worked for me and hope it can help you.
import { NullPresenceChannel } from 'laravel-echo/src/channel'
I’m going to close this because I feel that there isn’t much progress here to make anymore. All the types seem to be defined properly on all channel classes so I wouldn’t know how this problem could exist. The solution from https://github.com/laravel/echo/pull/241 also doesn’t seems to be wanted because we don’t want the listen method to be defined on the presence channels interface.
Anyone’s free to send in a PR and explain in detail why it would be needed, thanks.