Skip to content

Commit cf479fc

Browse files
committed
Add regression test for #29168
1 parent dbea08f commit cf479fc

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

tests/cases/compiler/contextualTypeShouldBeLiteral.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,30 @@ let xyz: LikeA | LikeB = {
9393
}
9494
};
9595

96-
xyz;
96+
xyz;
97+
98+
// Repro from #29168
99+
100+
interface TestObject {
101+
type?: 'object';
102+
items: {
103+
[k: string]: TestGeneric;
104+
};
105+
}
106+
107+
interface TestString {
108+
type: 'string';
109+
}
110+
111+
type TestGeneric = (TestString | TestObject) & { [k: string]: any; };
112+
113+
const test: TestGeneric = {
114+
items: {
115+
hello: { type: 'string' },
116+
world: {
117+
items: {
118+
nested: { type: 'string' }
119+
}
120+
}
121+
}
122+
};

0 commit comments

Comments
 (0)