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
app\app.ts(46,1): error TS2322: Type '{ field: { qwerty: string; }; }' is not assignable to type 'Test'.
Types of property 'field' are incompatible.
Type '{ qwerty: string; }' is not assignable to type '{ [key: string]: string; }'.
Index signature is missing in type '{ qwerty: string; }'.
If I modify my code to this then I don't get an error
interface Test {
field: {[key: string]: string};
}
var test: Test;
test = {
field: {qwerty: 'qwerty'}
};
The text was updated successfully, but these errors were encountered:
robianmcd
changed the title
incompatible types error unless I use an object literal for a dictionary object
incompatible types error unless I use an inline object literal for a dictionary object
Apr 1, 2016
TypeScript Version:
1.8.7
Code
Expected behavior:
I don't see any errors.
Actual behavior:
I get the following error:
If I modify my code to this then I don't get an error
The text was updated successfully, but these errors were encountered: