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
classA{getbar(){return"Overwritten by getter";}}constfoo=newA()consta={// False-positive error because `bar` will not be overwritten by a get accessorbar: "Was not overwritten",
...foo,}// `bar` is correctly not in `b`'s type, because it's from a get accessorconstb={
...foo,}// logs `{"bar": "Was not overwritten"}`console.log(a)// logs `{}`console.log(b)
π Actual behavior
An error is thrown on line 10, reporting that bar is overwritten. However, get accessors do not overwrite properties during spread behaviour.
π Expected behavior
The error should not be reported, because bar is not actually overwritten. This is already recognised, as the type of b shows the bar property is excluded when not specified in the literal.
The text was updated successfully, but these errors were encountered:
It's kind of a separate bug though, isn't it? The type of b shows clearly that the enumerability is tracked in some way. It seems odd that that would then not be used for the overwriting diagnostic.
Bug Report
π Search Terms
spread, get, accessor, class
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
An error is thrown on line 10, reporting that
bar
is overwritten. However, get accessors do not overwrite properties during spread behaviour.π Expected behavior
The error should not be reported, because
bar
is not actually overwritten. This is already recognised, as the type ofb
shows thebar
property is excluded when not specified in the literal.The text was updated successfully, but these errors were encountered: