You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
Compile error on the second line because {z?: number} is incompatible with {z: string}
Actual behavior:
No Error
Obviously the code above is nonsensical but I spun this out of a special case in #19869 since that one ended up being about generic function inferences and I realized this is something different.
Some more code examples that make me think my example should have a compile error:
declareconsta2: {z: string}&{[Kinnever]: string}constb2: {z: number}=a2// TS2322: Type '{ z: string; } & {}' is not assignable to type '{ z: number; }'.declareconsta3: {z: string}&{}constb3: {z?: number}=a3// TS2322: Type '{ z: string; }' is not assignable to type '{ z?: number | undefined; }'.declareconsta4: {z: string,y: string}&{[Kinnever]: string}constb4: {z?: number,y: string}=a4// TS2322: Type '{ z: string; y: string; } & {}' is not assignable to type '{ z?: number | undefined; y: string; }'.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.7.0-dev.20171110
Code
Expected behavior:
Compile error on the second line because
{z?: number}
is incompatible with{z: string}
Actual behavior:
No Error
Obviously the code above is nonsensical but I spun this out of a special case in #19869 since that one ended up being about generic function inferences and I realized this is something different.
Some more code examples that make me think my example should have a compile error:
The text was updated successfully, but these errors were encountered: