mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 02:29:04 +03:00
17 lines
315 B
TypeScript
17 lines
315 B
TypeScript
// @strict: true
|
|
|
|
interface X {
|
|
a?: { aProp: string };
|
|
b?: { bProp: string };
|
|
}
|
|
type AorB = { a: object; b: undefined } | { a: undefined; b: object };
|
|
|
|
declare const q: X & AorB;
|
|
|
|
if (q.a !== undefined) {
|
|
q.a.aProp;
|
|
} else {
|
|
// q.b is previously incorrectly inferred as potentially undefined
|
|
q.b.bProp;
|
|
}
|