Closed
Description
TypeScript Version: 2.7.0-dev.201xxxxx
Search Terms:
definite assignment assertion object shorthand
Code
interface A {
a: string;
}
let As: A[] = [];
let a: string | undefined = 'ff';
function f() {
As.push({ a! }); // Error
}
Expected behavior:
No error
Actual behavior:
Argument of type '{ a: boolean; }' is not assignable to parameter of type 'A'.
Types of property 'a' are incompatible.
Type 'boolean' is not assignable to type 'string'.
Related Issues: