-
Notifications
You must be signed in to change notification settings - Fork 434
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
CustomEvent.detail is null when not defined #1585
Comments
What about this code? new CustomEvent("myEvent", { detail: false }); Edit: I am surprised but this seems to work with your PR, too. JFYI: This is easier to debug in playground with instant type highlighting: let A: RealDetailType<undefined>
// ^?
let B: RealDetailType<void>
// ^?
let C: RealDetailType<null>
// ^?
let D: RealDetailType<string | undefined>
// ^?
let E: RealDetailType<boolean>
// ^? |
I didn't know about the I'm not sure to understand the problem with |
I thought |
CustomEvent.detail is defined as follows:
Source:
TypeScript-DOM-lib-generator/inputfiles/overridingTypes.jsonc
Lines 538 to 540 in 957eced
This is slightly wrong as CustomEvent.detail defaults to
null
when not defined: PlaygroundThe playground contains a fix I suggest:
detail: T extends {} ? T : null
I'll open a PR referring to this issue
The text was updated successfully, but these errors were encountered: