-
-
Notifications
You must be signed in to change notification settings - Fork 571
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 StructuredCloneable
type
#897
Add StructuredCloneable
type
#897
Conversation
3cc77c2
to
ab3f77e
Compare
ab3f77e
to
4c117f3
Compare
I think this PR needs to wait for #898 to merge. |
Tests are failing now. Not sure how we can handle DOM types conditionally. |
I'm not sure there's a way to conditionally enable dom types. I tried using a triple-slash directive but that seems to include the DOM types across the entire project. Though if we aren't including DOM types in type-fest in general, we could just remove the web variant. The only DOM types I can really foresee having widespread use would be |
Removed the dedicated web variant to remove the dependency on the DOM library. `Blob` and `File` compile without DOM and were folded into the standard variant.
Relevant: microsoft/TypeScript#31894 |
I think we could do it by adding a |
StructuredCloneable
/StructuredCloneableWeb
typesStructuredCloneable
type
Adding the sub-export would probably involve changes to the testing/build infrastructure (running twice for non-dom/dom builds), which I'm not familiar with, but if you want to implement that I'd be happy to add back the web type. If we're doing a sub-export I think it wouldn't even need to have a separate name, just |
Thanks :) |
This adds two types for values losslessly cloneable using
structuredClone
.Notes:
structuredClone
isn't able to losslessly clone them (they're cloned as baseError
instances). After doing some research I couldn't figure out a way to include the root Error class but exclude subclasses, so I just accepted the limitation and documented the discrepancy.Fixes #855