-
Notifications
You must be signed in to change notification settings - Fork 395
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 types for Comlink.finalizer
props on objects.
#631
Comments
“exposed object” is the object that you pass to Comlink.expose({
a: 1,
b: "lol",
[Comlink.finalizer]() {
console.log("Finalized");
}
}); the finalizer will be called when the proxy on the other side is garbage collected or released. |
I've never tried defining it inside If the types are structured in such a way that it only recognizes it inside In this kinda contrived example I've tried exposing a single function and a nested object and multiple questions came up:
|
No
No
function f() { ... }
f[Comlink.finalizer] = () => ...
Comlink.expose(f);
No,
Can you make a small repro case and file a bug?
Just like I showed in my previous comment. Or am I misunderstanding you?
The finalizer isn’t exposed. I used a |
Ooof, seems that the formatting/reply got a bit jumbled. For 1. and 2. – this should be mentioned in the docs, and a mechanism should be implemented that would warn the user if they somehow manage to use For 6. – the repro is here. The issue is that I used For 8. — having an option on It's also not clear if the finalizer can be mutated after being passed to |
There is no TypeScript inference for the
Comlink.finalizer
prop, and it will always throw an error.Additionally, it's not clear what a "exposed object" is, and on which end it should be called.
The text was updated successfully, but these errors were encountered: