Skip to content

Commit 53b96d9

Browse files
authored
Update DOM 2022-01-26 (microsoft#47623)
Improves types for FileSystemHandle.kind in subtypes, plus other bcd updates.
1 parent c191e7c commit 53b96d9

11 files changed

+150
-26
lines changed

src/lib/dom.generated.d.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,24 @@ interface KeyframeEffectOptions extends EffectTiming {
683683
pseudoElement?: string | null;
684684
}
685685

686+
interface LockInfo {
687+
clientId?: string;
688+
mode?: LockMode;
689+
name?: string;
690+
}
691+
692+
interface LockManagerSnapshot {
693+
held?: LockInfo[];
694+
pending?: LockInfo[];
695+
}
696+
697+
interface LockOptions {
698+
ifAvailable?: boolean;
699+
mode?: LockMode;
700+
signal?: AbortSignal;
701+
steal?: boolean;
702+
}
703+
686704
interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo {
687705
configuration?: MediaDecodingConfiguration;
688706
}
@@ -1885,7 +1903,7 @@ interface AbortSignal extends EventTarget {
18851903
declare var AbortSignal: {
18861904
prototype: AbortSignal;
18871905
new(): AbortSignal;
1888-
// abort(): AbortSignal; - To be re-added in the future
1906+
abort(reason?: any): AbortSignal;
18891907
};
18901908

18911909
interface AbstractRange {
@@ -2946,6 +2964,7 @@ interface CSSStyleDeclaration {
29462964
scrollSnapAlign: string;
29472965
scrollSnapStop: string;
29482966
scrollSnapType: string;
2967+
scrollbarGutter: string;
29492968
shapeImageThreshold: string;
29502969
shapeMargin: string;
29512970
shapeOutside: string;
@@ -3243,6 +3262,20 @@ declare var CacheStorage: {
32433262
new(): CacheStorage;
32443263
};
32453264

3265+
interface CanvasCaptureMediaStreamTrack extends MediaStreamTrack {
3266+
readonly canvas: HTMLCanvasElement;
3267+
requestFrame(): void;
3268+
addEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
3269+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
3270+
removeEventListener<K extends keyof MediaStreamTrackEventMap>(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
3271+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
3272+
}
3273+
3274+
declare var CanvasCaptureMediaStreamTrack: {
3275+
prototype: CanvasCaptureMediaStreamTrack;
3276+
new(): CanvasCaptureMediaStreamTrack;
3277+
};
3278+
32463279
interface CanvasCompositing {
32473280
globalAlpha: number;
32483281
globalCompositeOperation: GlobalCompositeOperation;
@@ -5090,6 +5123,7 @@ declare var FileSystemDirectoryEntry: {
50905123

50915124
/** Available only in secure contexts. */
50925125
interface FileSystemDirectoryHandle extends FileSystemHandle {
5126+
readonly kind: "directory";
50935127
getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
50945128
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
50955129
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
@@ -5135,6 +5169,7 @@ declare var FileSystemFileEntry: {
51355169

51365170
/** Available only in secure contexts. */
51375171
interface FileSystemFileHandle extends FileSystemHandle {
5172+
readonly kind: "file";
51385173
getFile(): Promise<File>;
51395174
}
51405175

@@ -5456,6 +5491,7 @@ interface GlobalEventHandlersEventMap {
54565491
"select": Event;
54575492
"selectionchange": Event;
54585493
"selectstart": Event;
5494+
"slotchange": Event;
54595495
"stalled": Event;
54605496
"submit": SubmitEvent;
54615497
"suspend": Event;
@@ -5690,6 +5726,7 @@ interface GlobalEventHandlers {
56905726
* @param ev The event.
56915727
*/
56925728
onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
5729+
onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null;
56935730
/**
56945731
* Occurs when the seek operation ends.
56955732
* @param ev The event.
@@ -5707,6 +5744,7 @@ interface GlobalEventHandlers {
57075744
onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null;
57085745
onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
57095746
onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null;
5747+
onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
57105748
/**
57115749
* Occurs when the download has stopped.
57125750
* @param ev The event.
@@ -8896,6 +8934,29 @@ declare var Location: {
88968934
new(): Location;
88978935
};
88988936

8937+
/** Available only in secure contexts. */
8938+
interface Lock {
8939+
readonly mode: LockMode;
8940+
readonly name: string;
8941+
}
8942+
8943+
declare var Lock: {
8944+
prototype: Lock;
8945+
new(): Lock;
8946+
};
8947+
8948+
/** Available only in secure contexts. */
8949+
interface LockManager {
8950+
query(): Promise<LockManagerSnapshot>;
8951+
request(name: string, callback: LockGrantedCallback): Promise<any>;
8952+
request(name: string, options: LockOptions, callback: LockGrantedCallback): Promise<any>;
8953+
}
8954+
8955+
declare var LockManager: {
8956+
prototype: LockManager;
8957+
new(): LockManager;
8958+
};
8959+
88998960
interface MathMLElementEventMap extends ElementEventMap, DocumentAndElementEventHandlersEventMap, GlobalEventHandlersEventMap {
89008961
}
89018962

@@ -10222,6 +10283,7 @@ interface PerformanceEventTiming extends PerformanceEntry {
1022210283
readonly processingEnd: DOMHighResTimeStamp;
1022310284
readonly processingStart: DOMHighResTimeStamp;
1022410285
readonly target: Node | null;
10286+
toJSON(): any;
1022510287
}
1022610288

1022710289
declare var PerformanceEventTiming: {
@@ -10944,6 +11006,7 @@ interface RTCRtpTransceiver {
1094411006
readonly mid: string | null;
1094511007
readonly receiver: RTCRtpReceiver;
1094611008
readonly sender: RTCRtpSender;
11009+
setCodecPreferences(codecs: RTCRtpCodecCapability[]): void;
1094711010
stop(): void;
1094811011
}
1094911012

@@ -11158,6 +11221,7 @@ interface ResizeObserverEntry {
1115811221
readonly borderBoxSize: ReadonlyArray<ResizeObserverSize>;
1115911222
readonly contentBoxSize: ReadonlyArray<ResizeObserverSize>;
1116011223
readonly contentRect: DOMRectReadOnly;
11224+
readonly devicePixelContentBoxSize: ReadonlyArray<ResizeObserverSize>;
1116111225
readonly target: Element;
1116211226
}
1116311227

@@ -13127,6 +13191,7 @@ interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML {
1312713191
readonly host: Element;
1312813192
readonly mode: ShadowRootMode;
1312913193
onslotchange: ((this: ShadowRoot, ev: Event) => any) | null;
13194+
readonly slotAssignment: SlotAssignmentMode;
1313013195
/** Throws a "NotSupportedError" DOMException if context object is a shadow root. */
1313113196
addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: ShadowRoot, ev: ShadowRootEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
1313213197
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -16915,6 +16980,10 @@ interface IntersectionObserverCallback {
1691516980
(entries: IntersectionObserverEntry[], observer: IntersectionObserver): void;
1691616981
}
1691716982

16983+
interface LockGrantedCallback {
16984+
(lock: Lock | null): any;
16985+
}
16986+
1691816987
interface MediaSessionActionHandler {
1691916988
(details: MediaSessionActionDetails): void;
1692016989
}
@@ -17543,6 +17612,7 @@ declare var onresize: ((this: Window, ev: UIEvent) => any) | null;
1754317612
* @param ev The event.
1754417613
*/
1754517614
declare var onscroll: ((this: Window, ev: Event) => any) | null;
17615+
declare var onsecuritypolicyviolation: ((this: Window, ev: SecurityPolicyViolationEvent) => any) | null;
1754617616
/**
1754717617
* Occurs when the seek operation ends.
1754817618
* @param ev The event.
@@ -17560,6 +17630,7 @@ declare var onseeking: ((this: Window, ev: Event) => any) | null;
1756017630
declare var onselect: ((this: Window, ev: Event) => any) | null;
1756117631
declare var onselectionchange: ((this: Window, ev: Event) => any) | null;
1756217632
declare var onselectstart: ((this: Window, ev: Event) => any) | null;
17633+
declare var onslotchange: ((this: Window, ev: Event) => any) | null;
1756317634
/**
1756417635
* Occurs when the download has stopped.
1756517636
* @param ev The event.
@@ -17771,6 +17842,7 @@ type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
1777117842
type KeyType = "private" | "public" | "secret";
1777217843
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
1777317844
type LineAlignSetting = "center" | "end" | "start";
17845+
type LockMode = "exclusive" | "shared";
1777417846
type MediaDecodingType = "file" | "media-source" | "webrtc";
1777517847
type MediaDeviceKind = "audioinput" | "audiooutput" | "videoinput";
1777617848
type MediaEncodingType = "record" | "webrtc";

src/lib/dom.iterable.generated.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ interface PluginArray {
168168
[Symbol.iterator](): IterableIterator<Plugin>;
169169
}
170170

171+
interface RTCRtpTransceiver {
172+
setCodecPreferences(codecs: Iterable<RTCRtpCodecCapability>): void;
173+
}
174+
171175
interface RTCStatsReport extends ReadonlyMap<string, any> {
172176
}
173177

src/lib/webworker.generated.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,24 @@ interface KeyAlgorithm {
302302
name: string;
303303
}
304304

305+
interface LockInfo {
306+
clientId?: string;
307+
mode?: LockMode;
308+
name?: string;
309+
}
310+
311+
interface LockManagerSnapshot {
312+
held?: LockInfo[];
313+
pending?: LockInfo[];
314+
}
315+
316+
interface LockOptions {
317+
ifAvailable?: boolean;
318+
mode?: LockMode;
319+
signal?: AbortSignal;
320+
steal?: boolean;
321+
}
322+
305323
interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo {
306324
configuration?: MediaDecodingConfiguration;
307325
}
@@ -1516,6 +1534,7 @@ declare var FileReaderSync: {
15161534

15171535
/** Available only in secure contexts. */
15181536
interface FileSystemDirectoryHandle extends FileSystemHandle {
1537+
readonly kind: "directory";
15191538
getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise<FileSystemDirectoryHandle>;
15201539
getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise<FileSystemFileHandle>;
15211540
removeEntry(name: string, options?: FileSystemRemoveOptions): Promise<void>;
@@ -1529,6 +1548,7 @@ declare var FileSystemDirectoryHandle: {
15291548

15301549
/** Available only in secure contexts. */
15311550
interface FileSystemFileHandle extends FileSystemHandle {
1551+
readonly kind: "file";
15321552
getFile(): Promise<File>;
15331553
}
15341554

@@ -2093,6 +2113,29 @@ interface KHR_parallel_shader_compile {
20932113
readonly COMPLETION_STATUS_KHR: GLenum;
20942114
}
20952115

2116+
/** Available only in secure contexts. */
2117+
interface Lock {
2118+
readonly mode: LockMode;
2119+
readonly name: string;
2120+
}
2121+
2122+
declare var Lock: {
2123+
prototype: Lock;
2124+
new(): Lock;
2125+
};
2126+
2127+
/** Available only in secure contexts. */
2128+
interface LockManager {
2129+
query(): Promise<LockManagerSnapshot>;
2130+
request(name: string, callback: LockGrantedCallback): Promise<any>;
2131+
request(name: string, options: LockOptions, callback: LockGrantedCallback): Promise<any>;
2132+
}
2133+
2134+
declare var LockManager: {
2135+
prototype: LockManager;
2136+
new(): LockManager;
2137+
};
2138+
20962139
interface MediaCapabilities {
20972140
decodingInfo(configuration: MediaDecodingConfiguration): Promise<MediaCapabilitiesDecodingInfo>;
20982141
encodingInfo(configuration: MediaEncodingConfiguration): Promise<MediaCapabilitiesEncodingInfo>;
@@ -5577,6 +5620,10 @@ interface FrameRequestCallback {
55775620
(time: DOMHighResTimeStamp): void;
55785621
}
55795622

5623+
interface LockGrantedCallback {
5624+
(lock: Lock | null): any;
5625+
}
5626+
55805627
interface OnErrorEventHandlerNonNull {
55815628
(event: Event | string, source?: string, lineno?: number, colno?: number, error?: Error): any;
55825629
}
@@ -5750,6 +5797,7 @@ type ImageOrientation = "flipY" | "none";
57505797
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
57515798
type KeyType = "private" | "public" | "secret";
57525799
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
5800+
type LockMode = "exclusive" | "shared";
57535801
type MediaDecodingType = "file" | "media-source" | "webrtc";
57545802
type MediaEncodingType = "record" | "webrtc";
57555803
type NotificationDirection = "auto" | "ltr" | "rtl";

tests/baselines/reference/baseCheck.errors.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
1+
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
22
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
33
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
44
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'.
2020
constructor(x: number) {
2121
super(0, loc);
2222
~~~
23-
!!! error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
24-
!!! related TS2728 tests/cases/compiler/baseCheck.ts:2:7: 'ELoc' is declared here.
23+
!!! error TS2552: Cannot find name 'loc'. Did you mean 'Lock'?
24+
!!! related TS2728 /.ts/lib.dom.d.ts:8963:13: 'Lock' is declared here.
2525
}
2626

2727
m() {

tests/baselines/reference/extendArray.errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ tests/cases/compiler/extendArray.ts(7,32): error TS2552: Cannot find name '_elem
1212
collect(fn:(e:_element) => _element[]) : any[];
1313
~~~~~~~~
1414
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
15-
!!! related TS2728 /.ts/lib.dom.d.ts:4844:13: 'Element' is declared here.
15+
!!! related TS2728 /.ts/lib.dom.d.ts:4877:13: 'Element' is declared here.
1616
~~~~~~~~
1717
!!! error TS2552: Cannot find name '_element'. Did you mean 'Element'?
18-
!!! related TS2728 /.ts/lib.dom.d.ts:4844:13: 'Element' is declared here.
18+
!!! related TS2728 /.ts/lib.dom.d.ts:4877:13: 'Element' is declared here.
1919
}
2020
}
2121

0 commit comments

Comments
 (0)