TypeScript/tests/cases/compiler/deeplyNestedCheck.ts
Anders Hejlsberg 9ff378aab3
Exclude types originating in literals from recursion depth limiter check (#34742)
* Exclude types originating in literals from recursion depth limiter check

* Add tests

* Accept new baselines

* Remove superfluous test
2019-10-31 06:14:43 -07:00

54 lines
993 B
TypeScript

// Repro from #14794
interface DataSnapshot<X = {}> {
child(path: string): DataSnapshot;
}
interface Snapshot<T> extends DataSnapshot {
child<U extends Extract<keyof T, string>>(path: U): Snapshot<T[U]>;
}
// Repro from 34619
interface A { b: B[] }
interface B { c: C }
interface C { d: D[] }
interface D { e: E[] }
interface E { f: F[] }
interface F { g: G }
interface G { h: H[] }
interface H { i: string }
const x: A = {
b: [
{
c: {
d: [
{
e: [
{
f: [
{
g: {
h: [
{
// i: '',
},
],
},
},
],
},
],
},
],
},
},
],
};
// Repro from 34619
const a1: string[][][][][] = [[[[[42]]]]];
const a2: string[][][][][][][][][][] = [[[[[[[[[[42]]]]]]]]]];