Closed as not planned
Closed as not planned
Description
π Search Terms
getters, types, classes, classes with getters
π Version & Regression Information
- This is incorrect type inference
- This is the behavior in every version I tried, I tried on Nightly, 5.4.4, 3.3.3, 4.3.5
β― Playground Link
π» Code
type AProps = {
id: number;
}
class A {
constructor(private readonly props: AProps) {}
get id(): number {
return this.props.id;
}
}
const e: AProps = new A({ id: 1 });
e.id = 3;
π Actual behavior
Fails on execute without typescript errors
π Expected behavior
It is necessary to notify the user that the class type and the user-defined type of the function argument are incompatible with each other
Additional information about the issue
No response