Skip to content

Commit 3934aff

Browse files
committed
backport type update from #8618
1 parent 6a37b32 commit 3934aff

File tree

1 file changed

+147
-1
lines changed
  • packages/miniflare/src/plugins/core/proxy

1 file changed

+147
-1
lines changed

packages/miniflare/src/plugins/core/proxy/types.ts

Lines changed: 147 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,154 @@ export type OverloadUnion9<T> = T extends {
184184
| ((...args: P9) => R9)
185185
: OverloadUnion8<T>;
186186

187+
export type OverloadUnion10<T> = T extends {
188+
(...args: infer P1): infer R1;
189+
(...args: infer P2): infer R2;
190+
(...args: infer P3): infer R3;
191+
(...args: infer P4): infer R4;
192+
(...args: infer P5): infer R5;
193+
(...args: infer P6): infer R6;
194+
(...args: infer P7): infer R7;
195+
(...args: infer P8): infer R8;
196+
(...args: infer P9): infer R9;
197+
(...args: infer P10): infer R10;
198+
}
199+
?
200+
| ((...args: P1) => R1)
201+
| ((...args: P2) => R2)
202+
| ((...args: P3) => R3)
203+
| ((...args: P4) => R4)
204+
| ((...args: P5) => R5)
205+
| ((...args: P6) => R6)
206+
| ((...args: P7) => R7)
207+
| ((...args: P8) => R8)
208+
| ((...args: P9) => R9)
209+
| ((...args: P10) => R10)
210+
: OverloadUnion9<T>;
211+
212+
export type OverloadUnion11<T> = T extends {
213+
(...args: infer P1): infer R1;
214+
(...args: infer P2): infer R2;
215+
(...args: infer P3): infer R3;
216+
(...args: infer P4): infer R4;
217+
(...args: infer P5): infer R5;
218+
(...args: infer P6): infer R6;
219+
(...args: infer P7): infer R7;
220+
(...args: infer P8): infer R8;
221+
(...args: infer P9): infer R9;
222+
(...args: infer P10): infer R10;
223+
(...args: infer P11): infer R11;
224+
}
225+
?
226+
| ((...args: P1) => R1)
227+
| ((...args: P2) => R2)
228+
| ((...args: P3) => R3)
229+
| ((...args: P4) => R4)
230+
| ((...args: P5) => R5)
231+
| ((...args: P6) => R6)
232+
| ((...args: P7) => R7)
233+
| ((...args: P8) => R8)
234+
| ((...args: P9) => R9)
235+
| ((...args: P10) => R10)
236+
| ((...args: P11) => R11)
237+
: OverloadUnion10<T>;
238+
239+
export type OverloadUnion12<T> = T extends {
240+
(...args: infer P1): infer R1;
241+
(...args: infer P2): infer R2;
242+
(...args: infer P3): infer R3;
243+
(...args: infer P4): infer R4;
244+
(...args: infer P5): infer R5;
245+
(...args: infer P6): infer R6;
246+
(...args: infer P7): infer R7;
247+
(...args: infer P8): infer R8;
248+
(...args: infer P9): infer R9;
249+
(...args: infer P10): infer R10;
250+
(...args: infer P11): infer R11;
251+
(...args: infer P12): infer R12;
252+
}
253+
?
254+
| ((...args: P1) => R1)
255+
| ((...args: P2) => R2)
256+
| ((...args: P3) => R3)
257+
| ((...args: P4) => R4)
258+
| ((...args: P5) => R5)
259+
| ((...args: P6) => R6)
260+
| ((...args: P7) => R7)
261+
| ((...args: P8) => R8)
262+
| ((...args: P9) => R9)
263+
| ((...args: P10) => R10)
264+
| ((...args: P11) => R11)
265+
| ((...args: P12) => R12)
266+
: OverloadUnion11<T>;
267+
268+
export type OverloadUnion13<T> = T extends {
269+
(...args: infer P1): infer R1;
270+
(...args: infer P2): infer R2;
271+
(...args: infer P3): infer R3;
272+
(...args: infer P4): infer R4;
273+
(...args: infer P5): infer R5;
274+
(...args: infer P6): infer R6;
275+
(...args: infer P7): infer R7;
276+
(...args: infer P8): infer R8;
277+
(...args: infer P9): infer R9;
278+
(...args: infer P10): infer R10;
279+
(...args: infer P11): infer R11;
280+
(...args: infer P12): infer R12;
281+
(...args: infer P13): infer R13;
282+
}
283+
?
284+
| ((...args: P1) => R1)
285+
| ((...args: P2) => R2)
286+
| ((...args: P3) => R3)
287+
| ((...args: P4) => R4)
288+
| ((...args: P5) => R5)
289+
| ((...args: P6) => R6)
290+
| ((...args: P7) => R7)
291+
| ((...args: P8) => R8)
292+
| ((...args: P9) => R9)
293+
| ((...args: P10) => R10)
294+
| ((...args: P11) => R11)
295+
| ((...args: P12) => R12)
296+
| ((...args: P13) => R13)
297+
: OverloadUnion12<T>;
298+
299+
// `KVNamespace#{get,getWithMetadata}()` each have 14 overloads :D
300+
export type OverloadUnion14<T> = T extends {
301+
(...args: infer P1): infer R1;
302+
(...args: infer P2): infer R2;
303+
(...args: infer P3): infer R3;
304+
(...args: infer P4): infer R4;
305+
(...args: infer P5): infer R5;
306+
(...args: infer P6): infer R6;
307+
(...args: infer P7): infer R7;
308+
(...args: infer P8): infer R8;
309+
(...args: infer P9): infer R9;
310+
(...args: infer P10): infer R10;
311+
(...args: infer P11): infer R11;
312+
(...args: infer P12): infer R12;
313+
(...args: infer P13): infer R13;
314+
(...args: infer P14): infer R14;
315+
}
316+
?
317+
| ((...args: P1) => R1)
318+
| ((...args: P2) => R2)
319+
| ((...args: P3) => R3)
320+
| ((...args: P4) => R4)
321+
| ((...args: P5) => R5)
322+
| ((...args: P6) => R6)
323+
| ((...args: P7) => R7)
324+
| ((...args: P8) => R8)
325+
| ((...args: P9) => R9)
326+
| ((...args: P10) => R10)
327+
| ((...args: P11) => R11)
328+
| ((...args: P12) => R12)
329+
| ((...args: P13) => R13)
330+
| ((...args: P14) => R14)
331+
: OverloadUnion13<T>;
332+
187333
export type OverloadUnion<T extends (...args: any[]) => any> =
188334
// Functions with no parameters pass the `extends` checks in the
189335
// `OverloadUnionN` types with `(...args: unknown[]) => unknown` for the
190336
// other overloads. Therefore, filter them out early.
191-
Parameters<T> extends [] ? T : OverloadUnion9<T>;
337+
Parameters<T> extends [] ? T : OverloadUnion14<T>;

0 commit comments

Comments
 (0)