-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements readonly property should be readonly #11578
Labels
Working as Intended
The behavior described is the intended behavior; this is not a bug
Comments
The class correctly implements the interface. I know this is a duplicate but I can't seem to find the corresponding issue. Regardless, |
thanks @aluanhaddad |
mhegazy
added
the
Working as Intended
The behavior described is the intended behavior; this is not a bug
label
Oct 14, 2016
TypeScript is allowing assignment both ways - shouldn't there be a compile error in the following? (There might be an issue open for that but I couldn't find one). interface I {
readonly name: string;
}
interface C {
name: string;
}
let i: I;
let c: C;
i = c; // OK, readable & writable is assignable to readable
c = i; // OK but why? readable shouldn't be assignable to readable & writable |
Yes that's it exactly, thanks @mhegazy |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
TypeScript Version: 2.0.3
Code
Expected behavior:
Compilation error.
C.name
should be declared asreadonly
.Actual behavior:
Compilation success. No errors/warnings
The text was updated successfully, but these errors were encountered: