Closed
Description
TypeScript Version: v4.1.0-dev.20200824
Search Terms:
Code
TS:
export type XMLObject<T> = {
$A: {
[K in keyof T]?: XMLObject<T[K]>[]
},
$O: {
[K in keyof T]?: {
$$?: Record<string, string>
} & (T[K] extends string ? {$:string} : XMLObject<T[K]>)
},
$$?: Record<string, string>,
} & {
[K in keyof T]?: (
T[K] extends string ? string
: XMLObject<T[K]>
)
};
const p:XMLObject<{foo:string}> = {};
JS:
/**
* @template T
* @typedef {{
$A: {
[K in keyof T]?: XMLObject<T[K]>[]
},
$O: {
[K in keyof T]?: {
$$?: Record<string, string>
} & (T[K] extends string ? {$:string} : XMLObject<T[K]>)
},
$$?: Record<string, string>,
} & {
[K in keyof T]?: (
T[K] extends string ? string
: XMLObject<T[K]>
)
}} XMLObject<T> */
/** @type {XMLObject<{foo:string}>} */
const p = {};
Expected behavior:
VSCode Intellisense outputs should match and results should somewhat as fast in JS as in TS.
Actual behavior:
Extremely long parsing time, Intellisense mismatch and long, infinitely looping type details. Hovering over XMLObject
in the playground link takes a very long time on JS.
Playground Link:
Related Issues: