Bug Report
🔎 Search Terms
typeguard exclude union
🕗 Version & Regression Information
v4.6.2
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about typeguards
⏯ Playground Link
Playground link with relevant code
💻 Code
type AAA = {
c: 0
b: 1
} | {
c: Exclude<number, 0>
x: 1
}
const a = {} as unknown as AAA
if (a.c !== 0) a.x
🙁 Actual behavior
error
Property 'x' does not exist on type 'AAA'.
Property 'x' does not exist on type '{ c: 0; b: 1; }'.
🙂 Expected behavior
no error