-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeBugA bug in TypeScriptA bug in TypeScriptDomain: 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 this
Milestone
Description
lib.dom.d.ts currently has two different type declarations for the setSelectionRange() API for HTMLInputElement and HTMLTextAreaElement.
For HTMLInputElement (permalink):
setSelectionRange(start?: number, end?: number, direction?: string): void;For HTMLTextAreaElement (permalink):
setSelectionRange(start: number, end: number): void;However, both are wrong, if I'm not mistaken. According to MDN, the correct type declaration would be the following:
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;Note that neither start nor end are optional. I also added a union of string literal types to type the (optional) direction parameter more precisely.
Metadata
Metadata
Assignees
Labels
Breaking ChangeWould introduce errors in existing codeWould introduce errors in existing codeBugA bug in TypeScriptA bug in TypeScriptDomain: 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 this