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
Argument of type '{ '@type': string; }' is not assignable to parameter of type 'Foo'.
Types of property ''@type'' are incompatible.
Type 'string' is not assignable to type '"foo/bar"'.
const value: {
'@type': string;
}
Clearly I've hardcoded the correct literal. TypeScript should not be inferring that my hardcoded literal is any old string, and should recognize that it matches the string subtype described in the interface.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.6.0-insiders20171013 and 2.5.3
Code
Expected behavior:
No errors.
Actual behavior:
Clearly I've hardcoded the correct literal. TypeScript should not be inferring that my hardcoded literal is any old string, and should recognize that it matches the string subtype described in the interface.
Interestingly, this works:
The text was updated successfully, but these errors were encountered: