TypeScript Version: 3.1.1+
Search Terms: DeepReadonly
Code
exporttypePrimitive=string|number|boolean|undefined|null|Function|symbol;exporttypeDeepReadonly<T>=Textends[infer A] ? DeepReadonlyObject<[A]> :
Textends[infer A, infer B] ? DeepReadonlyObject<[A,B]> :
Textends[infer A, infer B, infer C] ? DeepReadonlyObject<[A,B,C]> :
Textends[infer A, infer B, infer C, infer D] ? DeepReadonlyObject<[A,B,C,D]> :
Textends[infer A, infer B, infer C, infer D, infer E] ? DeepReadonlyObject<[A,B,C,D,E]> :
Textends[infer A, infer B, infer C, infer D, infer E, infer F] ? DeepReadonlyObject<[A,B,C,D,E,F]> :
Textends[infer A, infer B, infer C, infer D, infer E, infer F, infer G] ? DeepReadonlyObject<[A,B,C,D,E,F,G]> :
TextendsMap<infer U, infer V> ? ReadonlyMap<DeepReadonlyObject<U>,DeepReadonlyObject<V>> :
TextendsSet<infer U> ? ReadonlySet<DeepReadonlyObject<U>> :
TextendsPromise<infer U> ? Promise<DeepReadonlyObject<U>> :
TextendsPrimitive ? T :
Textends(infer A)[] ? DeepReadonlyArray<A> :
DeepReadonlyObject<T>;interfaceDeepReadonlyArray<T>extendsReadonlyArray<DeepReadonly<T>>{}typeDeepReadonlyObject<T>={readonly[PinkeyofT]: DeepReadonly<T[P]>}Expected behavior:
This used to work as of typescript 3.0.1
Actual behavior:
In typescript 3.1.1 a new error is thrown saying that the type is cyclical
In typescript 3.2+ the above error, instead ends up casting the type as any
Playground Link:
Here's a gist with tests for the type
https://gist.github.com/masterkidan/7322752f569b1bba53e0426266768623
Playground link
Related Issues:
#27421
#13923
#26236
TypeScript Version: 3.1.1+
Search Terms: DeepReadonly
Code
Expected behavior:
This used to work as of typescript 3.0.1
Actual behavior:
In typescript 3.1.1 a new error is thrown saying that the type is cyclical
In typescript 3.2+ the above error, instead ends up casting the type as
anyPlayground Link:
Here's a gist with tests for the type
https://gist.github.com/masterkidan/7322752f569b1bba53e0426266768623
Playground link
Related Issues:
#27421
#13923
#26236