Closed johndoe457 closed 3 years ago
Here is an intuitive simplification, the minimal code needed to produce the problem:
type User = { isMale: true } | ({ isMale: false } & ( { isPregnant: true;} | { isPregnant: false;} )); const johnDoe: User = { isMale: true, isPregnant: true, };
I should, of course, get a ts(2322) error, as johnDoe somehow went against nature and is now pregnant, but it doesn't show it as a problem.
ts(2322)
johnDoe
Now, what's interesting, is that if I cause another error, for example:
const johnDoe: User = { isMale: true, isPregnant: true, pi: 3.14, };
Now I get the ts(2322) error for the isPregnant property, doesn't matter if the new wrong property (pi) is declared before or after the isPregnant property.
isPregnant
pi
Without more context, this sounds like a general TypeScript error and not a tslint problem. Please file this against TypeScript
Here is an intuitive simplification, the minimal code needed to produce the problem:
I should, of course, get a
ts(2322)
error, asjohnDoe
somehow went against nature and is now pregnant, but it doesn't show it as a problem.Now, what's interesting, is that if I cause another error, for example:
Now I get the
ts(2322)
error for theisPregnant
property, doesn't matter if the new wrong property (pi
) is declared before or after theisPregnant
property.