Update DOM 2022-01-26 (#47623)

Improves types for FileSystemHandle.kind in subtypes, plus other bcd
updates.
This commit is contained in:
Nathan Shively-Sanders
2022-01-26 12:29:25 -08:00
committed by GitHub
parent c191e7c942
commit 53b96d9ddf
11 changed files with 150 additions and 26 deletions
+73 -1
View File
@@ -683,6 +683,24 @@ interface KeyframeEffectOptions extends EffectTiming {
pseudoElement?: string | null;
}
interface LockInfo {
clientId?: string;
mode?: LockMode;
name?: string;
}
interface LockManagerSnapshot {
held?: LockInfo[];
pending?: LockInfo[];
}
interface LockOptions {
ifAvailable?: boolean;
mode?: LockMode;
signal?: AbortSignal;
steal?: boolean;
}
interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo {
configuration?: MediaDecodingConfiguration;
}
@@ -1885,7 +1903,7 @@ interface AbortSignal extends EventTarget {
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// abort(): AbortSignal; - To be re-added in the future
abort(reason?: any): AbortSignal;
};
interface AbstractRange {
@@ -2946,6 +2964,7 @@ interface CSSStyleDeclaration {
scrollSnapAlign: string;
scrollSnapStop: string;
scrollSnapType: string;
scrollbarGutter: string;
shapeImageThreshold: string;
shapeMargin: string;
shapeOutside: string;
@@ -3243,6 +3262,20 @@ declare var CacheStorage: {
new(): CacheStorage;
};
interface CanvasCaptureMediaStreamTrack extends MediaStreamTrack {
readonly canvas: HTMLCanvasElement;
requestFrame(): void;
addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var CanvasCaptureMediaStreamTrack: {
prototype: CanvasCaptureMediaStreamTrack;
new(): CanvasCaptureMediaStreamTrack;
};
interface CanvasCompositing {
globalAlpha: number;
globalCompositeOperation: GlobalCompositeOperation;
@@ -5090,6 +5123,7 @@ declare var FileSystemDirectoryEntry: {
/** Available only in secure contexts. */
interface FileSystemDirectoryHandle extends FileSystemHandle {
readonly kind: "directory";
getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
@@ -5135,6 +5169,7 @@ declare var FileSystemFileEntry: {
/** Available only in secure contexts. */
interface FileSystemFileHandle extends FileSystemHandle {
readonly kind: "file";
getFile(): Promise<File>;
}
@@ -5456,6 +5491,7 @@ interface GlobalEventHandlersEventMap {
"select": Event;
"selectionchange": Event;
"selectstart": Event;
"slotchange": Event;
"stalled": Event;
"submit": SubmitEvent;
"suspend": Event;
@@ -5690,6 +5726,7 @@ interface GlobalEventHandlers {
* @param ev The event.
*/
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
/**
* Occurs when the seek operation ends.
* @param ev The event.
@@ -5707,6 +5744,7 @@ interface GlobalEventHandlers {
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
/**
* Occurs when the download has stopped.
* @param ev The event.
@@ -8896,6 +8934,29 @@ declare var Location: {
new(): Location;
};
/** Available only in secure contexts. */
interface Lock {
readonly mode: LockMode;
readonly name: string;
}
declare var Lock: {
prototype: Lock;
new(): Lock;
};
/** Available only in secure contexts. */
interface LockManager {
query(): Promise<LockManagerSnapshot>;
request(name: string, callback: LockGrantedCallback): Promise<any>;
request(name: string, options: LockOptions, callback: LockGrantedCallback): Promise<any>;
}
declare var LockManager: {
prototype: LockManager;
new(): LockManager;
};
interface MathMLElementEventMap extends ElementEventMap, DocumentAndElementEventHandlersEventMap, GlobalEventHandlersEventMap {
}
@@ -10222,6 +10283,7 @@ interface PerformanceEventTiming extends PerformanceEntry {
readonly processingEnd: DOMHighResTimeStamp;
readonly processingStart: DOMHighResTimeStamp;
readonly target: Node | null;
toJSON(): any;
}
declare var PerformanceEventTiming: {
@@ -10944,6 +11006,7 @@ interface RTCRtpTransceiver {
readonly mid: string | null;
readonly receiver: RTCRtpReceiver;
readonly sender: RTCRtpSender;
setCodecPreferences(codecs: RTCRtpCodecCapability[]): void;
stop(): void;
}
@@ -11158,6 +11221,7 @@ interface ResizeObserverEntry {
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>;
readonly contentBoxSize: ReadonlyArray<ResizeObserverSize>;
readonly contentRect: DOMRectReadOnly;
readonly devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>;
readonly target: Element;
}
@@ -13127,6 +13191,7 @@ interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML {
readonly host: Element;
readonly mode: ShadowRootMode;
onslotchange: ((this: ShadowRoot, ev: Event) => any) | null;
readonly slotAssignment: SlotAssignmentMode;
/** Throws a "NotSupportedError" DOMException if context object is a shadow root. */
addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: ShadowRoot, ev: ShadowRootEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -16915,6 +16980,10 @@ interface IntersectionObserverCallback {
(entries: IntersectionObserverEntry[], observer: IntersectionObserver): void;
}
interface LockGrantedCallback {
(lock: Lock | null): any;
}
interface MediaSessionActionHandler {
(details: MediaSessionActionDetails): void;
}
@@ -17543,6 +17612,7 @@ declare var onresize: ((this: Window, ev: UIEvent) => any) | null;
* @param ev The event.
*/
declare var onscroll: ((this: Window, ev: Event) => any) | null;
declare var onsecuritypolicyviolation: ((this: Window, ev: SecurityPolicyViolationEvent) => any) | null;
/**
* Occurs when the seek operation ends.
* @param ev The event.
@@ -17560,6 +17630,7 @@ declare var onseeking: ((this: Window, ev: Event) => any) | null;
declare var onselect: ((this: Window, ev: Event) => any) | null;
declare var onselectionchange: ((this: Window, ev: Event) => any) | null;
declare var onselectstart: ((this: Window, ev: Event) => any) | null;
declare var onslotchange: ((this: Window, ev: Event) => any) | null;
/**
* Occurs when the download has stopped.
* @param ev The event.
@@ -17771,6 +17842,7 @@ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
type KeyType = "private" | "public" | "secret";
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
type LineAlignSetting = "center" | "end" | "start";
type LockMode = "exclusive" | "shared";
type MediaDecodingType = "file" | "media-source" | "webrtc";
type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput";
type MediaEncodingType = "record" | "webrtc";
+4
View File
@@ -168,6 +168,10 @@ interface PluginArray {
[Symbol.iterator](): IterableIterator<Plugin>;
}
interface RTCRtpTransceiver {
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
}
interface RTCStatsReport extends ReadonlyMap<string, any> {
}
+48
View File
@@ -302,6 +302,24 @@ interface KeyAlgorithm {
name: string;
}
interface LockInfo {
clientId?: string;
mode?: LockMode;
name?: string;
}
interface LockManagerSnapshot {
held?: LockInfo[];
pending?: LockInfo[];
}
interface LockOptions {
ifAvailable?: boolean;
mode?: LockMode;
signal?: AbortSignal;
steal?: boolean;
}
interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo {
configuration?: MediaDecodingConfiguration;
}
@@ -1516,6 +1534,7 @@ declare var FileReaderSync: {
/** Available only in secure contexts. */
interface FileSystemDirectoryHandle extends FileSystemHandle {
readonly kind: "directory";
getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
@@ -1529,6 +1548,7 @@ declare var FileSystemDirectoryHandle: {
/** Available only in secure contexts. */
interface FileSystemFileHandle extends FileSystemHandle {
readonly kind: "file";
getFile(): Promise<File>;
}
@@ -2093,6 +2113,29 @@ interface KHR_parallel_shader_compile {
readonly COMPLETION_STATUS_KHR: GLenum;
}
/** Available only in secure contexts. */
interface Lock {
readonly mode: LockMode;
readonly name: string;
}
declare var Lock: {
prototype: Lock;
new(): Lock;
};
/** Available only in secure contexts. */
interface LockManager {
query(): Promise<LockManagerSnapshot>;
request(name: string, callback: LockGrantedCallback): Promise<any>;
request(name: string, options: LockOptions, callback: LockGrantedCallback): Promise<any>;
}
declare var LockManager: {
prototype: LockManager;
new(): LockManager;
};
interface MediaCapabilities {
decodingInfo(configuration: MediaDecodingConfiguration): Promise<MediaCapabilitiesDecodingInfo>;
encodingInfo(configuration: MediaEncodingConfiguration): Promise<MediaCapabilitiesEncodingInfo>;
@@ -5577,6 +5620,10 @@ interface FrameRequestCallback {
(time: DOMHighResTimeStamp): void;
}
interface LockGrantedCallback {
(lock: Lock | null): any;
}
interface OnErrorEventHandlerNonNull {
(event: Event | string, source?: string, lineno?: number, colno?: number, error?: Error): any;
}
@@ -5750,6 +5797,7 @@ type ImageOrientation = "flipY" | "none";
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
type KeyType = "private" | "public" | "secret";
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
type LockMode = "exclusive" | "shared";
type MediaDecodingType = "file" | "media-source" | "webrtc";
type MediaEncodingType = "record" | "webrtc";
type NotificationDirection = "auto" | "ltr" | "rtl";
@@ -1,4 +1,4 @@
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
@@ -20,8 +20,8 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
constructor(x: number) {
super(0, loc);
~~~
!!! error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
!!! related TS2728 tests/cases/compiler/baseCheck.ts:2:7: 'ELoc' is declared here.
!!! error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
!!! related TS2728 /.ts/lib.dom.d.ts:8963:13: 'Lock' is declared here.
}
m() {
@@ -12,10 +12,10 @@ tests/cases/compiler/extendArray.ts(7,32): error TS2552: Cannot find name '_elem
collect(fn:(e:_element) => _element[]) : any[];
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4844:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:4877:13: 'Element' is declared here.
~~~~~~~~
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4844:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:4877:13: 'Element' is declared here.
}
}
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ tests/cases/compiler/intersectionsOfLargeUnions2.ts(31,15): error TS2536: Type '
interface ElementTagNameMap {
~~~~~~~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'ElementTagNameMap'.
!!! related TS6203 /.ts/lib.dom.d.ts:17226:6: 'ElementTagNameMap' was also declared here.
!!! related TS6203 /.ts/lib.dom.d.ts:17295:6: 'ElementTagNameMap' was also declared here.
[index: number]: HTMLElement
}
@@ -13,7 +13,7 @@ tests/cases/compiler/test.tsx(9,17): error TS2552: Cannot find name 'createEleme
return <div />;
~~~
!!! error TS2552: Cannot find name 'createElement'. Did you mean 'frameElement'?
!!! related TS2728 /.ts/lib.dom.d.ts:17249:13: 'frameElement' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:17318:13: 'frameElement' is declared here.
}
}
@@ -13,6 +13,6 @@ tests/cases/compiler/test.tsx(9,17): error TS2552: Cannot find name 'MyElement'.
return <div />;
~~~
!!! error TS2552: Cannot find name 'MyElement'. Did you mean 'Element'?
!!! related TS2728 /.ts/lib.dom.d.ts:4844:13: 'Element' is declared here.
!!! related TS2728 /.ts/lib.dom.d.ts:4877:13: 'Element' is declared here.
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long