From 2249fb403a5e32fa96d5e5a8c4b94e687a9dc663 Mon Sep 17 00:00:00 2001 From: Marius Schulz Date: Mon, 4 Dec 2017 23:08:18 +0100 Subject: [PATCH] Fix type declaration for "setSelectionRange" API The `start` and `end` parameters aren't optional. Also, the `direction` parameter only accepts one of three string values, which are now modeled as a union of string literal types. More information: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange --- lib/lib.dom.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 0c3292a3bbc09..61ab7cf4e1d2e 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -5516,7 +5516,7 @@ interface HTMLInputElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start?: number, end?: number, direction?: string): void; + setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void; /** * Decrements a range input control's value by the value given by the Step attribute. If the optional parameter is used, it will decrement the input control's step value multiplied by the parameter's value. * @param n Value to decrement the value by. @@ -6979,7 +6979,7 @@ interface HTMLTextAreaElement extends HTMLElement { * @param start The offset into the text field for the start of the selection. * @param end The offset into the text field for the end of the selection. */ - setSelectionRange(start: number, end: number): void; + setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void; addEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: HTMLTextAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -15378,4 +15378,4 @@ type ServiceWorkerState = "installing" | "installed" | "activating" | "activated type Transport = "usb" | "nfc" | "ble"; type VideoFacingModeEnum = "user" | "environment" | "left" | "right"; type VisibilityState = "hidden" | "visible" | "prerender" | "unloaded"; -type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text"; \ No newline at end of file +type XMLHttpRequestResponseType = "" | "arraybuffer" | "blob" | "document" | "json" | "text";