Closed
Description
Bug Report
🔎 Search Terms
Omit, OR
🕗 Version & Regression Information
I tried multiple versions on the playground, but all(?) of them have it.
If using Omit, an OR statement doesn't work as expected anymore.
(sorry, I don't know how to call the (TypeA | TypeB)
part)
⏯ Playground Link
Playground link with relevant code
💻 Code
type AButNotB = { a: number; b?: never }
type BButNotA = { a?: never; b: number }
type Test = (AButNotB | BButNotA) & { c: number; d: number; e: number }
const test1: Omit<Test, "e"> = {
a: 1, // INCORRECT: where is the error??? `a` and `b` are both defined
b: 2,
c: 3,
d: 4,
}
const test2: Test = {
a: 1, // CORRECT: gives error
b: 2,
c: 3,
d: 4,
}
🙁 Actual behavior
No error for test1
🙂 Expected behavior
Error like test2
Metadata
Metadata
Assignees
Labels
No labels