-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
There are a handful of functions from lib.d.ts which are typically followed by a type assertion
const x = <HTMLDivElement>document.getElementById('zzz');
With the new inference changes, we can write a new overload
getElementById<T extends Element>(id: string): T
so that you can write the cleaner version
const x: HTMLDivElement = document.getElementById('zzz');
TODO: Figure out which functions these apply to
Metadata
Metadata
Assignees
Labels
DeclinedThe issue was declined as something which matches the TypeScript visionThe issue was declined as something which matches the TypeScript visionDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptSuggestionAn idea for TypeScriptAn idea for TypeScript