DOM suggestion: customisable history.state
type
#36178
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
dom lib window state history any unknown
Suggestion
Currently
window.history.state
has typeany
. Could we provide a way for users to customise this type? Perhaps by making it generic or allowing the type to be changed through declaration merging.Failing that, could we replace the
any
type withunknown
, so we have type safety and users are forced to validate/widen the type?Another possible solution: if TypeScript provided a way to override
any
types (#4062, #26188).Also related:
history
: use interface forLocationState
to allow augmentation DefinitelyTyped/DefinitelyTyped#41568history
: switch defaultLocationState
generic fromany
tounknown
DefinitelyTyped/DefinitelyTyped#41580Use Cases
Examples
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: