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
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 same
Expected 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
GuillaumeNury, metabacalhau, roddolf, martinsik, cainlevy and 362 moresteve-taylor0x0-mico and FrameMuse