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
classFoo{setbar(baz: string){}}constfoo=newFoo();constvalue: string=foo.bar;// This assignment should not be allowed, foo.bar will always be undefined!
π Actual behavior
There is no error reported during type-checking.
π Expected behavior
The type-checking should report an error for the assignment in the last line as foo.bar will always be undefined.
Additional information about the issue
#21759 is related, but that issue proposes a whole new language feature, this issue is solely about the lack of a type error.
The text was updated successfully, but these errors were encountered:
Things have changed since those comments. set is encoded into the declaration files (though with some bugs - playground link). We should reconsider this.
π Search Terms
"setter only", "setter-only"
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/MYGwhgzhAEBiD29oG8BQ0PQgUwC7QCMwAnACiIC8AuLXYgSwDsBzAShWgF9VvVh5GEfADNE0ALzRG2AO5xEpVgG4+AodABuYEAFdsNIQxYToo+ADoixJdAD0t6ABUAFvRiQI9ZowC22RvgQzvA6IAAmUvD4BNjQ2iDwMthhADSmiJYk0DL0ICBxIDJgAJ4wMdA6jGHYwkzJAIRAA
π» Code
π Actual behavior
There is no error reported during type-checking.
π Expected behavior
The type-checking should report an error for the assignment in the last line as
foo.bar
will always be undefined.Additional information about the issue
#21759 is related, but that issue proposes a whole new language feature, this issue is solely about the lack of a type error.
The text was updated successfully, but these errors were encountered: