TypeScript Version: Version 3.0.0-dev.20180628
Search Terms: tuple types
Code
type PromisedTuple<L extends any[], U = (...args: L) => void> =
U extends (h: infer H, ...args: infer R) ? [Promise<H>, ...PromisedTuple<R>] : []
type Promised = PromisedTuple<[1, 2, 3]>
// expect [Promise<1>, Promise<2>, Promise<3>]
Expected behavior:
Either produce type in comment above, or produce a compile error.
Actual behavior:
RangeError: Maximum call stack size exceeded at getTypeFromTypeNode
Related Issues: #24897 (comment)
Extended explanation:
This code tries to model the Array#map on a heterogeneous tuple type . It uses conditional type and generic default to work around recursion.
TypeScript Version: Version 3.0.0-dev.20180628
Search Terms: tuple types
Code
Expected behavior:
Either produce type in comment above, or produce a compile error.
Actual behavior:
RangeError: Maximum call stack size exceeded at
getTypeFromTypeNodeRelated Issues: #24897 (comment)
Extended explanation:
This code tries to model the
Array#mapon a heterogeneous tuple type . It uses conditional type and generic default to work around recursion.