Skip to content

Commit 683f378

Browse files
committed
fix: improve lib.dom.d.ts type definitions
so that it does not conflict with lib.dom.iterable.d.ts definitions. Merge branch 'fix-30' closes #30
2 parents 07a8425 + 1d001b8 commit 683f378

File tree

3 files changed

+109
-19
lines changed

3 files changed

+109
-19
lines changed

generated/lib.dom.d.ts

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,11 +2517,17 @@ declare var AudioParam: {
25172517
};
25182518

25192519
interface AudioParamMap {
2520-
forEach(
2521-
callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void,
2522-
thisArg?: any
2520+
forEach<This = undefined>(
2521+
callbackfn: (
2522+
this: This,
2523+
value: AudioParam,
2524+
key: string,
2525+
parent: this
2526+
) => void,
2527+
thisArg?: This
25232528
): void;
25242529
}
2530+
// forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void;
25252531

25262532
declare var AudioParamMap: {
25272533
prototype: AudioParamMap;
@@ -5951,11 +5957,12 @@ declare var Event: {
59515957
};
59525958

59535959
interface EventCounts {
5954-
forEach(
5955-
callbackfn: (value: number, key: string, parent: EventCounts) => void,
5956-
thisArg?: any
5960+
forEach<This = undefined>(
5961+
callbackfn: (this: This, value: number, key: string, parent: this) => void,
5962+
thisArg?: This
59575963
): void;
59585964
}
5965+
// forEach(callbackfn: (value: number, key: string, parent: EventCounts) => void, thisArg?: any): void;
59595966

59605967
declare var EventCounts: {
59615968
prototype: EventCounts;
@@ -6331,9 +6338,14 @@ interface FontFaceSet extends EventTarget {
63316338
readonly status: FontFaceSetLoadStatus;
63326339
check(font: string, text?: string): boolean;
63336340
load(font: string, text?: string): Promise<FontFace[]>;
6334-
forEach(
6335-
callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void,
6336-
thisArg?: any
6341+
forEach<This = undefined>(
6342+
callbackfn: (
6343+
this: This,
6344+
value: FontFace,
6345+
key: FontFace,
6346+
parent: this
6347+
) => void,
6348+
thisArg?: This
63376349
): void;
63386350
addEventListener<K extends keyof FontFaceSetEventMap>(
63396351
type: K,
@@ -6356,6 +6368,7 @@ interface FontFaceSet extends EventTarget {
63566368
options?: boolean | EventListenerOptions
63576369
): void;
63586370
}
6371+
// forEach(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any): void;
63596372

63606373
declare var FontFaceSet: {
63616374
prototype: FontFaceSet;
@@ -11692,11 +11705,17 @@ declare var MIDIInput: {
1169211705

1169311706
/** Available only in secure contexts. */
1169411707
interface MIDIInputMap {
11695-
forEach(
11696-
callbackfn: (value: MIDIInput, key: string, parent: MIDIInputMap) => void,
11697-
thisArg?: any
11708+
forEach<This = undefined>(
11709+
callbackfn: (
11710+
this: This,
11711+
value: MIDIInput,
11712+
key: string,
11713+
parent: this
11714+
) => void,
11715+
thisArg?: This
1169811716
): void;
1169911717
}
11718+
// forEach(callbackfn: (value: MIDIInput, key: string, parent: MIDIInputMap) => void, thisArg?: any): void;
1170011719

1170111720
declare var MIDIInputMap: {
1170211721
prototype: MIDIInputMap;
@@ -11745,11 +11764,17 @@ declare var MIDIOutput: {
1174511764

1174611765
/** Available only in secure contexts. */
1174711766
interface MIDIOutputMap {
11748-
forEach(
11749-
callbackfn: (value: MIDIOutput, key: string, parent: MIDIOutputMap) => void,
11750-
thisArg?: any
11767+
forEach<This = undefined>(
11768+
callbackfn: (
11769+
this: This,
11770+
value: MIDIOutput,
11771+
key: string,
11772+
parent: this
11773+
) => void,
11774+
thisArg?: This
1175111775
): void;
1175211776
}
11777+
// forEach(callbackfn: (value: MIDIOutput, key: string, parent: MIDIOutputMap) => void, thisArg?: any): void;
1175311778

1175411779
declare var MIDIOutputMap: {
1175511780
prototype: MIDIOutputMap;
@@ -14683,11 +14708,12 @@ declare var RTCSessionDescription: {
1468314708
};
1468414709

1468514710
interface RTCStatsReport {
14686-
forEach(
14687-
callbackfn: (value: any, key: string, parent: RTCStatsReport) => void,
14688-
thisArg?: any
14711+
forEach<This = undefined>(
14712+
callbackfn: (this: This, value: unknown, key: string, parent: this) => void,
14713+
thisArg?: This
1468914714
): void;
1469014715
}
14716+
// forEach(callbackfn: (value: any, key: string, parent: RTCStatsReport) => void, thisArg?: any): void;
1469114717

1469214718
declare var RTCStatsReport: {
1469314719
prototype: RTCStatsReport;

lib/lib.dom.d.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,67 @@
11
interface Body {
22
json(): Promise<JSONValue>;
33
}
4+
5+
interface AudioParamMap {
6+
forEach<This = undefined>(
7+
callbackfn: (
8+
this: This,
9+
value: AudioParam,
10+
key: string,
11+
parent: this
12+
) => void,
13+
thisArg?: This
14+
): void;
15+
}
16+
17+
interface EventCounts {
18+
forEach<This = undefined>(
19+
callbackfn: (this: This, value: number, key: string, parent: this) => void,
20+
thisArg?: This
21+
): void;
22+
}
23+
24+
/** Available only in secure contexts. */
25+
interface MIDIInputMap {
26+
forEach<This = undefined>(
27+
callbackfn: (
28+
this: This,
29+
value: MIDIInput,
30+
key: string,
31+
parent: this
32+
) => void,
33+
thisArg?: This
34+
): void;
35+
}
36+
37+
/** Available only in secure contexts. */
38+
interface MIDIOutputMap {
39+
forEach<This = undefined>(
40+
callbackfn: (
41+
this: This,
42+
value: MIDIOutput,
43+
key: string,
44+
parent: this
45+
) => void,
46+
thisArg?: This
47+
): void;
48+
}
49+
50+
interface RTCStatsReport {
51+
forEach<This = undefined>(
52+
callbackfn: (this: This, value: unknown, key: string, parent: this) => void,
53+
thisArg?: This
54+
): void;
55+
}
56+
57+
interface FontFaceSet extends EventTarget {
58+
forEach<This = undefined>(
59+
callbackfn: (
60+
this: This,
61+
value: FontFace,
62+
key: FontFace,
63+
parent: this
64+
) => void,
65+
thisArg?: This
66+
): void;
67+
}

tests/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "esnext",
4-
"lib": ["esnext", "dom"],
4+
"lib": ["esnext", "dom", "dom.iterable"],
55
"module": "esnext",
66
"moduleResolution": "node",
77
"noEmit": true,

0 commit comments

Comments
 (0)