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
string being assignable to your type is correct and working as intended. A string can be accessed with an index signature.
The problem stems from TypeScript not distinguishing between readonly and mutable types, or no way to specify immutability in the type-system. The immutable type string should not be assignable to a mutable interface. Issues to track this would be #18770 and #10725.
TypeScript Version: 4.1.0-beta
Search Terms: string assignable index signature number
Code
Expected behavior:
Second call to setValueAtIndex should raise a compiler error.
Actual behavior:
No compiler error is raised, which results in a runtime error because string indeces are read-only.
Playground Link: Playground
The text was updated successfully, but these errors were encountered: