-
Notifications
You must be signed in to change notification settings - Fork 124
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
add structuredclone
support
#82
Comments
If you would love to, I'd like to create a PR for this topic!! |
@ryoppippi Could you do me a favour? Could you dig out in TS's issues the reason why structuredClone returns any and not T? Feels like an obvious candidate to be a generic function, I'd love to know why they didn't go that way. |
They have a system that automatically generates types from new specs, but I guess it is not advanced enough to support generics (or maybe the spec is not written in a way that gets picked up as a generic function), so it ended up with |
In typescript 5.0, |
@ryoppippi Which version exactly is it typed fully? Both my declare function structuredClone(value: any, options?: StructuredSerializeOptions): any; |
@Svish However, in Sveltekit project, it works fine tho. My environment is here idk why it works. But I think we need to open this issue again, maybe. Thank you for letting me know this issue @Svish |
https://developer.mozilla.org/en-US/docs/Web/API/structuredClone
structuredclone
returnsany
, and this is horrible asJSON.parse
I think there are two solution for this.
unknown
instead ofany
Thanks
The text was updated successfully, but these errors were encountered: