-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
microsoft/TypeScript-DOM-lib-generator
#319Labels
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 2.2.1
Code
If CustomEvent were parameterized, code that fires events could declare what the type of detail is so that listeners could be more type safe:
interface MyDetail {
foo: string;
}
declare global {
interface DocumentEventMap {
'my-event': CustomEvent<MyDetail>;
}
}
document.addEventListener('my-event', (e) => {
e.detail.foo; // ok
e.detail.bar; // warning
});Metadata
Metadata
Assignees
Labels
Domain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueHelp WantedYou can do thisYou can do thisSuggestionAn idea for TypeScriptAn idea for TypeScript