google / google/closure-compiler
`@const` fields should be overrideable in subclasses
Open
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
The following seems reasonable to me, but currently runs afoul of the const checker.
```js
class Base {}
/** @const {number} */
Base.prototype.foo = 0;
class Derived extends Base {
constructor(/** number */ foo) {
/** @const */
this.foo = foo;
}
}
```
The error can be suppressed with `@suppress {const}` on the field assignment, but it doesn't seem like that should be required.
Contributor guide
Assessment
This issue has not been assessed yet.