-
Notifications
You must be signed in to change notification settings - Fork 2
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
Typescript Compilation Error #25
Comments
Hey @atyshka, |
I get the same issue if I remove return type annotation:
produces
I also thought it might be a problem with the input parameters so I tried changing the input types:
but I get the same error
|
Ok no problem, it's not urgent, I appreciate the help. I'm not extensively versed in typescript, but I have gone through the core js library code and have not been able to find a solution. The official GUI sample app uses js instead of ts so that hasn't helped either. It's currently in a VueJS app right now, I'll try and see if I can get a minimal reproducible example we can both test |
Oh, it appears that there should not be a websocket arg to the callback, only the event. So something like this:
Because the websocket is bound to |
Do you have a working compile-able example of the typescript interface? I attempted to implement the sample code like so:
Typescript does not seem to like the callback signature, giving me the following error:
error TS2345: Argument of type '(_connection: WebSocket, _ev: globalThis.Event) => void' is not assignable to parameter of type '(this: WebSocket, ev: Event) => any'.
22 furhat.onConnectionError((_connection: WebSocket, _ev: globalThis.Event) => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Of course I can remove the arguments and have a no-argument callback like with
furhat.onConnectionClose
, but I may need to use the event data. Any ideas why typescript is unhappy with this function signature?The text was updated successfully, but these errors were encountered: