TypeScript Version: 2.2.2
Code
interfaceIndexType{[key: string]: string;}interfacedoesNotWork{hola: string;}typedoWorks={hola: string};lety: IndexType;constcorrectA={hola: "hello"};constcorrectB: doWorks={hola: "hello"};//error should be assignable to yconsterror: doesNotWork={hola: "hello "};y=correctA;y=correctB;y=error;//Index signature is missing in type 'doesNotWork'y={... error};//workaround but not equivalent since the instance is not the sameExpected behavior:
The code should not result on a compiler error since the interface doesNotWork is equivalent to the type { hola: string }
Actual behavior:
Variable error of type doesNotWork can't be assigned to y
TypeScript Version: 2.2.2
Code
Expected behavior:
The code should not result on a compiler error since the interface
doesNotWorkis equivalent to the type{ hola: string }Actual behavior:
Variable
errorof typedoesNotWorkcan't be assigned to y