Skip to content

Commit 044d70f

Browse files
committed
Add regression tests
1 parent e0599fd commit 044d70f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/cases/compiler/instantiateContextualTypes.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,37 @@ declare function passContentsToFunc<T>(outerBox: T, consumer: BoxConsumerFromOut
140140
declare const outerBoxOfString: OuterBox<string>;
141141

142142
passContentsToFunc(outerBoxOfString, box => box.value);
143+
144+
// Repro from #32349
145+
146+
type DooDad = 'SOMETHING' | 'ELSE' ;
147+
148+
class Interesting {
149+
public compiles = () : Promise<DooDad> => {
150+
return Promise.resolve().then(() => {
151+
if (1 < 2) {
152+
return 'SOMETHING';
153+
}
154+
return 'ELSE';
155+
});
156+
};
157+
public doesnt = () : Promise<DooDad> => {
158+
return Promise.resolve().then(() => {
159+
return 'ELSE';
160+
});
161+
};
162+
public slightlyDifferentErrorMessage = () : Promise<DooDad> => {
163+
return Promise.resolve().then(() => {
164+
if (1 < 2) {
165+
return 'SOMETHING';
166+
}
167+
return 'SOMETHING';
168+
});
169+
};
170+
}
171+
172+
// Repro from #32349
173+
174+
declare function invoke<T>(f: () => T): T;
175+
176+
let xx: 0 | 1 | 2 = invoke(() => 1);

0 commit comments

Comments
 (0)