Search Terms
property override accessor
Suggestion
Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509.
It's reasonable to report an error on property override accessor in most case, but I'm using experimentalDecorators to inject a property accessor in prototype.
Currently I cannot find a solution for this use case, so I'm suggesting to add a new compilerOption to disable this check(strictOnly?) for compatibility.
Use Cases
class Animal {
private _age: number
get age(){ return this._age }
set age(value){ this._age = value }
}
class Dog extends Animal {
@defaultValue(100) age: number; // Unexpected error here
}
function defaultValue(value) {
return (obj, name) => {
Object.defineProperty(obj, name, {
get() { return value }
})
}
}
Checklist
My suggestion meets these guidelines:
Search Terms
property override accessor
Suggestion
Previously in 3.9, property can override an accessor with no emit errors. And in 4.0 beta, a break change was introduced by #33509.
It's reasonable to report an error on property override accessor in most case, but I'm using
experimentalDecoratorsto inject a property accessor in prototype.Currently I cannot find a solution for this use case, so I'm suggesting to add a new compilerOption to disable this check(strictOnly?) for compatibility.
Use Cases
Checklist
My suggestion meets these guidelines: