Closed kungfooman closed 10 months ago
Example:
/** * This creates a nested array of a given type and depth (see examples). * * @example * NestArray<string, 1>; // string[] * @example * NestArray<number, 2>; // number[][] * @example * NestArray<string, 3>; // string[][][] etc. * @template T * @template {number} Depth * @template {never[]} [Acc=[]] * @typedef {Acc['length'] extends Depth ? T : NestArray<T[], Depth, [...Acc, never]>} NestArray */
Current output is simply:
expandType.mjs:206 toSourceTS> unhandled kind - make sure to understand you cannot reverse TS enums
Putting them into structure is one thing, but type-checking them at runtime is an entirely different matter for later.
In order to parse the entire example, I also have to implement:
Acc['length'] - a TSIndexedAccessType NestArray<...> - a "non-stock" reference type, unlike Promise, Map, Array etc. [...Acc, never] - a RestType
Acc['length']
TSIndexedAccessType
NestArray<...>
[...Acc, never]
RestType
Example:
Current output is simply:
Putting them into structure is one thing, but type-checking them at runtime is an entirely different matter for later.
In order to parse the entire example, I also have to implement:
Acc['length']
- aTSIndexedAccessType
NestArray<...>
- a "non-stock" reference type, unlike Promise, Map, Array etc.[...Acc, never]
- aRestType