Skip to content

Commit 4d8e2a9

Browse files
committed
fix
1 parent ab735ba commit 4d8e2a9

File tree

3 files changed

+265
-90
lines changed

3 files changed

+265
-90
lines changed

docs/diff/dom.generated.d.ts.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,148 @@ Index: dom.generated.d.ts
126126
}
127127

128128
declare var RTCStatsReport: {
129+
@@ -34051,13 +34071,20 @@
130+
handler: TimerHandler,
131+
timeout?: number,
132+
...arguments: any[]
133+
): number;
134+
+
135+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/structuredClone) */
136+
-declare function structuredClone<T = any>(
137+
+declare function structuredClone<
138+
+ const T extends BetterTypeScriptLibInternals.StructuredClone.NeverOrUnknown<
139+
+ BetterTypeScriptLibInternals.StructuredClone.StructuredCloneOutput<
140+
+ BetterTypeScriptLibInternals.StructuredClone.AvoidCyclicConstraint<T>
141+
+ >
142+
+ >,
143+
+>(
144+
value: T,
145+
options?: StructuredSerializeOptions,
146+
-): T;
147+
+): BetterTypeScriptLibInternals.StructuredClone.StructuredCloneOutput<T>;
148+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/sessionStorage) */
149+
declare var sessionStorage: Storage;
150+
declare function addEventListener<K extends keyof WindowEventMap>(
151+
type: K,
152+
@@ -34712,4 +34739,119 @@
153+
| "blob"
154+
| "document"
155+
| "json"
156+
| "text";
157+
+// --------------------
158+
+
159+
+declare namespace BetterTypeScriptLibInternals {
160+
+ export namespace StructuredClone {
161+
+ type Basics = [
162+
+ EvalError,
163+
+ RangeError,
164+
+ ReferenceError,
165+
+ TypeError,
166+
+ SyntaxError,
167+
+ URIError,
168+
+ Error,
169+
+ Boolean,
170+
+ String,
171+
+ Date,
172+
+ RegExp,
173+
+ ];
174+
+ type DOMSpecifics = [
175+
+ DOMException,
176+
+ DOMMatrix,
177+
+ DOMMatrixReadOnly,
178+
+ DOMPoint,
179+
+ DOMPointReadOnly,
180+
+ DOMQuad,
181+
+ DOMRect,
182+
+ DOMRectReadOnly,
183+
+ ];
184+
+ type FileSystemTypeFamily = [
185+
+ FileSystemDirectoryHandle,
186+
+ FileSystemFileHandle,
187+
+ FileSystemHandle,
188+
+ ];
189+
+ type WebGPURelatedTypeFamily = [
190+
+ // GPUCompilationInfo,
191+
+ // GPUCompilationMessage,
192+
+ ];
193+
+ type TypedArrayFamily = [
194+
+ Int8Array,
195+
+ Int16Array,
196+
+ Int32Array,
197+
+ BigInt64Array,
198+
+ Uint8Array,
199+
+ Uint16Array,
200+
+ Uint32Array,
201+
+ BigUint64Array,
202+
+ Uint8ClampedArray,
203+
+ ];
204+
+ type Weaken = [
205+
+ ...Basics,
206+
+ // AudioData,
207+
+ Blob,
208+
+ // CropTarget,
209+
+ // CryptoTarget,
210+
+ ...DOMSpecifics,
211+
+ ...FileSystemTypeFamily,
212+
+ ...WebGPURelatedTypeFamily,
213+
+ File,
214+
+ FileList,
215+
+ ...TypedArrayFamily,
216+
+ DataView,
217+
+ ImageBitmap,
218+
+ ImageData,
219+
+ RTCCertificate,
220+
+ VideoFrame,
221+
+ ];
222+
+
223+
+ type MapSubtype<R> = {
224+
+ [k in keyof Weaken]: R extends Weaken[k] ? true : false;
225+
+ };
226+
+ type SelectNumericLiteral<H> = number extends H ? never : H;
227+
+ type FilterByNumericLiteralKey<R extends Record<string | number, any>> = {
228+
+ [k in keyof R as `${R[k] extends true ? Exclude<SelectNumericLiteral<k>, symbol> : never}`]: [];
229+
+ };
230+
+ type HitWeakenEntry<E> = keyof FilterByNumericLiteralKey<MapSubtype<E>>;
231+
+
232+
+ type NonCloneablePrimitive =
233+
+ | Function
234+
+ | { new (...args: any[]): any }
235+
+ | ((...args: any[]) => any)
236+
+ | symbol;
237+
+
238+
+ type StructuredCloneOutputObject<T> = {
239+
+ -readonly [K in Exclude<keyof T, symbol> as [
240+
+ StructuredCloneOutput<T[K]>,
241+
+ ] extends [never]
242+
+ ? never
243+
+ : K]: StructuredCloneOutput<T[K]>;
244+
+ };
245+
+
246+
+ type StructuredCloneOutput<T> = T extends NonCloneablePrimitive
247+
+ ? never
248+
+ : T extends ReadonlyArray<any>
249+
+ ? number extends T["length"]
250+
+ ? Array<StructuredCloneOutput<T[number]>>
251+
+ : T extends readonly [infer X, ...infer XS]
252+
+ ? [StructuredCloneOutput<X>, ...StructuredCloneOutput<XS>]
253+
+ : T extends []
254+
+ ? []
255+
+ : StructuredCloneOutputObject<T>
256+
+ : T extends Map<infer K, infer V>
257+
+ ? Map<StructuredCloneOutput<K>, StructuredCloneOutput<V>>
258+
+ : T extends Set<infer E>
259+
+ ? Set<StructuredCloneOutput<E>>
260+
+ : T extends Record<any, any>
261+
+ ? HitWeakenEntry<T> extends never
262+
+ ? StructuredCloneOutputObject<T>
263+
+ : Weaken[HitWeakenEntry<T>]
264+
+ : T;
265+
+
266+
+ type AvoidCyclicConstraint<T> = [T] extends [infer R] ? R : never;
267+
+
268+
+ // 上限が不正にきつくなっているのを無視する
269+
+ type NeverOrUnknown<T> = [T] extends [never] ? never : unknown;
270+
+ }
271+
+}
129272

130273
```

generated/lib.dom.d.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34833,15 +34833,13 @@ declare namespace BetterTypeScriptLibInternals {
3483334833
| ((...args: any[]) => any)
3483434834
| symbol;
3483534835

34836-
type Writeable<T> = T extends readonly []
34837-
? []
34838-
: T extends readonly [infer X, ...infer XS]
34839-
? [X, ...XS]
34840-
: T extends { [x: PropertyKey]: any }
34841-
? {
34842-
-readonly [P in keyof T]: Writeable<T[P]>;
34843-
}
34844-
: T;
34836+
type StructuredCloneOutputObject<T> = {
34837+
-readonly [K in Exclude<keyof T, symbol> as [
34838+
StructuredCloneOutput<T[K]>,
34839+
] extends [never]
34840+
? never
34841+
: K]: StructuredCloneOutput<T[K]>;
34842+
};
3484534843

3484634844
type StructuredCloneOutput<T> = T extends NonCloneablePrimitive
3484734845
? never
@@ -34850,23 +34848,17 @@ declare namespace BetterTypeScriptLibInternals {
3485034848
? Array<StructuredCloneOutput<T[number]>>
3485134849
: T extends readonly [infer X, ...infer XS]
3485234850
? [StructuredCloneOutput<X>, ...StructuredCloneOutput<XS>]
34853-
: Writeable<T>
34851+
: T extends []
34852+
? []
34853+
: StructuredCloneOutputObject<T>
3485434854
: T extends Map<infer K, infer V>
3485534855
? Map<StructuredCloneOutput<K>, StructuredCloneOutput<V>>
3485634856
: T extends Set<infer E>
3485734857
? Set<StructuredCloneOutput<E>>
3485834858
: T extends Record<any, any>
3485934859
? HitWeakenEntry<T> extends never
34860-
? Writeable<{
34861-
-readonly [k in Exclude<
34862-
keyof T,
34863-
symbol
34864-
> as `${[StructuredCloneOutput<T[k]>] extends [never] ? never : k}`]: StructuredCloneOutput<
34865-
T[k]
34866-
>;
34867-
}>
34868-
: // hit
34869-
Weaken[HitWeakenEntry<T>]
34860+
? StructuredCloneOutputObject<T>
34861+
: Weaken[HitWeakenEntry<T>]
3487034862
: T;
3487134863

3487234864
type AvoidCyclicConstraint<T> = [T] extends [infer R] ? R : never;

0 commit comments

Comments
 (0)