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
interfaceFoo{[index: string]: any;name: string;}// Case 1: no errorvarf1: Foo={name: 'FooOne',};// Case 2: no error varf2=function(): Foo{return{name: 'FooTwo',};}// Case 3:// Compiler Error: error TS2322: Build: Type '{ name: string; }' is not // assignable to type 'Foo'// IDE Error: Cannot convert '{ name: string; }' to 'Foo': Index signatures // of types '{ name: string; }' and 'Foo' are incompatible.varf3=(): Foo=>({name: 'FooThree',});
The expected result is there to be no error, since the object literal in the last case is indexable by string to return any.
The text was updated successfully, but these errors were encountered:
Hi,
TypeScript Version: 1.1.0.1
Here is the repro:
The expected result is there to be no error, since the object literal in the last case is indexable by
string
to returnany
.The text was updated successfully, but these errors were encountered: