-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: Incorrect onToggle event type #4615
Conversation
h('option', { value: 'foo' }); | ||
createElement('option', { value: 'foo' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the diff, placed this rather wonkily a few weeks ago. Moved it out so it wasn't sat in the middle of the event tests.
Damn, Edit: |
12d075c
to
a463c9a
Compare
// Remove when bumping TS minimum to >5.2 | ||
|
||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent) */ | ||
interface ToggleEvent extends Event { | ||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent/newState) */ | ||
readonly newState: string; | ||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ToggleEvent/oldState) */ | ||
readonly oldState: string; | ||
} | ||
|
||
declare var ToggleEvent: { | ||
prototype: ToggleEvent; | ||
new(type: string, eventInitDict?: ToggleEventInit): ToggleEvent; | ||
}; | ||
|
||
interface ToggleEventInit extends EventInit { | ||
newState?: string; | ||
oldState?: string; | ||
} | ||
|
||
// End TS >5.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've never done this before (to my knowledge), but maybe it's a viable strategy? It's not too gnarly and hopefully with the blocks it can be removed in the future pretty easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me. Admittedly I'm not even sure if we've settled on a particular TS version to support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We haven't, though we do have split types for supporting >5.1 & <5.1 at the moment.
Issue is that every time we've bumped up the minimum people in other communities have had problems -- unfortunate side effect of being popular for widgets & component libs. IIUC, Angular still restricts TS versions per (Angular) major, for example.
Closes #4614