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
interfaceMutable{x: number;}interfaceImmutable{readonlyx: number;}functionmutate(mut: Mutable){mut.x=5;}functionimmutate(imm: Immutable){// imm.x = 5; // this does not compile as expectedmutate(imm);// but this does}
Expected behavior: There should be a compiler error inside immutate saying that 'imm' cannot be used as a parameter to mutate since 'imm' is readonly while 'mut' is not
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.8.1
Search Terms: mutate readonly immutable mutable
Code
Expected behavior: There should be a compiler error inside immutate saying that 'imm' cannot be used as a parameter to mutate since 'imm' is readonly while 'mut' is not
Actual behavior: Compiles successfully
Playground Link: https://codesandbox.io/s/vnp9k2z32y
Related Issues:
The text was updated successfully, but these errors were encountered: