Skip to content

Commit

Permalink
feat: upgrade to TS 5.6 (#51)
Browse files Browse the repository at this point in the history
* chore: upgrade TypeScript to 5.6.2

* fix: improve TS 5.6 types

* docs: commit TS 5.6 diff

* chore: update package-lock.json
  • Loading branch information
uhyo authored Sep 23, 2024
1 parent 1c07b23 commit 5220515
Show file tree
Hide file tree
Showing 37 changed files with 1,152 additions and 1,308 deletions.
2 changes: 1 addition & 1 deletion TypeScript
Submodule TypeScript updated 4293 files
26 changes: 13 additions & 13 deletions docs/diff/dom.generated.d.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Index: dom.generated.d.ts
===================================================================
--- dom.generated.d.ts
+++ dom.generated.d.ts
@@ -2969,11 +2969,16 @@
@@ -2972,11 +2972,16 @@
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParamMap) */
Expand All @@ -25,7 +25,7 @@ Index: dom.generated.d.ts
}

declare var AudioParamMap: {
@@ -3394,9 +3399,9 @@
@@ -3401,9 +3406,9 @@
blob(): Promise<Blob>;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */
formData(): Promise<FormData>;
Expand All @@ -36,7 +36,7 @@ Index: dom.generated.d.ts
text(): Promise<string>;
}

@@ -6530,11 +6535,11 @@
@@ -6551,11 +6556,11 @@
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomStateSet) */
Expand All @@ -51,7 +51,7 @@ Index: dom.generated.d.ts
}

declare var CustomStateSet: {
@@ -8960,11 +8965,11 @@
@@ -8926,11 +8931,11 @@
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventCounts) */
Expand All @@ -66,7 +66,7 @@ Index: dom.generated.d.ts
}

declare var EventCounts: {
@@ -9508,11 +9513,16 @@
@@ -9462,11 +9467,16 @@
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check) */
check(font: string, text?: string): boolean;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load) */
Expand All @@ -86,7 +86,7 @@ Index: dom.generated.d.ts
addEventListener<K extends keyof FontFaceSetEventMap>(
type: K,
listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any,
@@ -15863,15 +15873,16 @@
@@ -15358,15 +15368,16 @@
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Highlight/priority) */
priority: number;
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Highlight/type) */
Expand All @@ -106,7 +106,7 @@ Index: dom.generated.d.ts
}

declare var Highlight: {
@@ -15880,15 +15891,16 @@
@@ -15375,15 +15386,16 @@
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HighlightRegistry) */
Expand All @@ -126,7 +126,7 @@ Index: dom.generated.d.ts
}

declare var HighlightRegistry: {
@@ -17314,11 +17326,16 @@
@@ -16809,11 +16821,16 @@
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIInputMap)
*/
Expand All @@ -146,7 +146,7 @@ Index: dom.generated.d.ts
}

declare var MIDIInputMap: {
@@ -17381,11 +17398,16 @@
@@ -16876,11 +16893,16 @@
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MIDIOutputMap)
*/
Expand All @@ -166,7 +166,7 @@ Index: dom.generated.d.ts
}

declare var MIDIOutputMap: {
@@ -19260,9 +19282,9 @@
@@ -18739,9 +18761,9 @@
new (): NodeList;
};

Expand All @@ -177,7 +177,7 @@ Index: dom.generated.d.ts
* Performs the specified action for each node in an list.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
@@ -21702,11 +21724,11 @@
@@ -21159,11 +21181,11 @@
};

/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/RTCStatsReport) */
Expand All @@ -192,7 +192,7 @@ Index: dom.generated.d.ts
}

declare var RTCStatsReport: {
@@ -34477,13 +34499,16 @@
@@ -33973,13 +33995,16 @@
handler: TimerHandler,
timeout?: number,
...arguments: any[]
Expand All @@ -211,7 +211,7 @@ Index: dom.generated.d.ts
declare var sessionStorage: Storage;
declare function addEventListener<K extends keyof WindowEventMap>(
type: K,
@@ -35141,4 +35166,125 @@
@@ -34638,4 +34663,125 @@
| "blob"
| "document"
| "json"
Expand Down
6 changes: 3 additions & 3 deletions docs/diff/es2015.generator.d.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Index: es2015.generator.d.ts
@@ -1,7 +1,7 @@
/// <reference lib="es2015.iterable" />

-interface Generator<T = unknown, TReturn = any, TNext = unknown>
-interface Generator<T = unknown, TReturn = any, TNext = any>
+interface Generator<T = unknown, TReturn = unknown, TNext = unknown>
extends Iterator<T, TReturn, TNext> {
extends IteratorObject<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
return(value: TReturn): IteratorResult<T, TReturn>;

```
65 changes: 35 additions & 30 deletions docs/diff/es2015.iterable.d.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,35 @@ Index: es2015.iterable.d.ts
===================================================================
--- es2015.iterable.d.ts
+++ es2015.iterable.d.ts
@@ -20,10 +20,9 @@
@@ -20,24 +20,23 @@

type IteratorResult<T, TReturn = any> =
| IteratorYieldResult<T>
| IteratorReturnResult<TReturn>;
-
-interface Iterator<T, TReturn = any, TNext = undefined> {
-interface Iterator<T, TReturn = any, TNext = any> {
+interface Iterator<T, TReturn = unknown, TNext = undefined> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): IteratorResult<T, TReturn>;
next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
return?(value?: TReturn): IteratorResult<T, TReturn>;
throw?(e?: any): IteratorResult<T, TReturn>;
@@ -32,9 +31,9 @@
interface Iterable<T> {
[Symbol.iterator](): Iterator<T>;
}

-interface IterableIterator<T> extends Iterator<T> {
+interface IterableIterator<T> extends Iterator<T, undefined, void> {
[Symbol.iterator](): IterableIterator<T>;
-interface Iterable<T, TReturn = any, TNext = any> {
+interface Iterable<T, TReturn = unknown, TNext = undefined> {
[Symbol.iterator](): Iterator<T, TReturn, TNext>;
}

interface Array<T> {
@@ -69,12 +68,12 @@
/**
* Describes a user-defined {@link Iterator} that is also iterable.
*/
-interface IterableIterator<T, TReturn = any, TNext = any>
+interface IterableIterator<T, TReturn = undefined, TNext = void>
extends Iterator<T, TReturn, TNext> {
[Symbol.iterator](): IterableIterator<T, TReturn, TNext>;
}

@@ -92,12 +91,12 @@
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
Expand All @@ -44,19 +49,19 @@ Index: es2015.iterable.d.ts
}

interface ReadonlyArray<T> {
@@ -98,9 +97,9 @@
@@ -121,9 +120,9 @@
}

interface IArguments {
/** Iterator */
- [Symbol.iterator](): IterableIterator<any>;
+ [Symbol.iterator](): IterableIterator<unknown>;
- [Symbol.iterator](): ArrayIterator<any>;
+ [Symbol.iterator](): ArrayIterator<unknown>;
}

interface Map<K, V> {
/** Returns an iterable of entries in the map. */
@@ -142,9 +141,8 @@
values(): IterableIterator<V>;
interface MapIterator<T>
extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
@@ -170,9 +169,8 @@
values(): MapIterator<V>;
}

interface MapConstructor {
Expand All @@ -65,7 +70,7 @@ Index: es2015.iterable.d.ts
}

interface WeakMap<K extends WeakKey, V> {}
@@ -211,17 +209,17 @@
@@ -244,17 +242,17 @@
* resolve, or rejected when any Promise is rejected.
* @param values An iterable of Promises.
* @returns A new Promise.
Expand All @@ -83,9 +88,9 @@ Index: es2015.iterable.d.ts
+ race<T>(values: Iterable<T>): Promise<Awaited<T>>;
}

interface String {
/** Iterator */
@@ -245,19 +243,23 @@
interface StringIterator<T>
extends IteratorObject<T, BuiltinIteratorReturn, unknown> {
@@ -283,19 +281,23 @@
}

interface Int8ArrayConstructor {
Expand Down Expand Up @@ -116,7 +121,7 @@ Index: es2015.iterable.d.ts
}

interface Uint8Array {
@@ -277,19 +279,23 @@
@@ -315,19 +317,23 @@
}

interface Uint8ArrayConstructor {
Expand Down Expand Up @@ -147,7 +152,7 @@ Index: es2015.iterable.d.ts
}

interface Uint8ClampedArray {
@@ -311,19 +317,23 @@
@@ -349,19 +355,23 @@
}

interface Uint8ClampedArrayConstructor {
Expand Down Expand Up @@ -178,7 +183,7 @@ Index: es2015.iterable.d.ts
}

interface Int16Array {
@@ -345,19 +355,23 @@
@@ -383,19 +393,23 @@
}

interface Int16ArrayConstructor {
Expand Down Expand Up @@ -209,7 +214,7 @@ Index: es2015.iterable.d.ts
}

interface Uint16Array {
@@ -377,19 +391,23 @@
@@ -415,19 +429,23 @@
}

interface Uint16ArrayConstructor {
Expand Down Expand Up @@ -240,7 +245,7 @@ Index: es2015.iterable.d.ts
}

interface Int32Array {
@@ -409,19 +427,23 @@
@@ -447,19 +465,23 @@
}

interface Int32ArrayConstructor {
Expand Down Expand Up @@ -271,7 +276,7 @@ Index: es2015.iterable.d.ts
}

interface Uint32Array {
@@ -441,19 +463,23 @@
@@ -479,19 +501,23 @@
}

interface Uint32ArrayConstructor {
Expand Down Expand Up @@ -302,7 +307,7 @@ Index: es2015.iterable.d.ts
}

interface Float32Array {
@@ -473,19 +499,23 @@
@@ -511,19 +537,23 @@
}

interface Float32ArrayConstructor {
Expand Down Expand Up @@ -333,7 +338,7 @@ Index: es2015.iterable.d.ts
}

interface Float64Array {
@@ -505,17 +535,21 @@
@@ -543,17 +573,21 @@
}

interface Float64ArrayConstructor {
Expand Down
12 changes: 6 additions & 6 deletions docs/diff/es2017.object.d.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,43 @@ Index: es2017.object.d.ts
+++ es2017.object.d.ts
@@ -2,34 +2,48 @@
/**
* Returns an array of values of the enumerable properties of an object
* Returns an array of values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
- values<T>(o: { [s: string]: T } | ArrayLike<T>): T[];
-
+ values<T>(o: ArrayLike<T>): T[];
/**
* Returns an array of values of the enumerable properties of an object
* Returns an array of values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
- values(o: {}): any[];
+ values<K extends PropertyKey, V>(
+ o: Record<K, V>,
+ ): (string extends K ? V : number extends K ? V : unknown)[];
+ /**
+ * Returns an array of values of the enumerable properties of an object
+ * Returns an array of values of the enumerable own properties of an object
+ * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
+ */
+ values(o: {}): unknown[];

/**
* Returns an array of key/values of the enumerable properties of an object
* Returns an array of key/values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
- entries<T>(o: { [s: string]: T } | ArrayLike<T>): [string, T][];
-
+ entries<T>(o: ArrayLike<T>): [string, T][];
/**
* Returns an array of key/values of the enumerable properties of an object
* Returns an array of key/values of the enumerable own properties of an object
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
- entries(o: {}): [string, any][];
+ entries<K extends PropertyKey, V>(
+ o: Record<K, V>,
+ ): [string, string extends K ? V : number extends K ? V : unknown][];
+ /**
+ * Returns an array of key/values of the enumerable properties of an object
+ * Returns an array of key/values of the enumerable own properties of an object
+ * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
+ */
+ entries(o: {}): [string, unknown][];
Expand Down
6 changes: 3 additions & 3 deletions docs/diff/es2018.asyncgenerator.d.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Index: es2018.asyncgenerator.d.ts
@@ -1,7 +1,5 @@
-/// <reference lib="es2018.asynciterable" />
-
-interface AsyncGenerator<T = unknown, TReturn = any, TNext = unknown>
-interface AsyncGenerator<T = unknown, TReturn = any, TNext = any>
+interface AsyncGenerator<T = unknown, TReturn = unknown, TNext = unknown>
extends AsyncIterator<T, TReturn, TNext> {
extends AsyncIteratorObject<T, TReturn, TNext> {
// NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
next(...[value]: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
return(

```
Loading

0 comments on commit 5220515

Please sign in to comment.