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
publicsetColor(color: Color3): void{for(constchildofthis.instance.GetChildren().filter((i): i is Frame=>child.IsA("Frame")))child.BackgroundColor3=color;}
In this instance an error should be thrown because the object being iterated is referencing the iteration variable in the callback for filter. This compiles with no error on roblox-ts@2.3.0.
This example also comes from me refactoring and forgetting to change child to i, and it went unnoticed until it errored in game.
The text was updated successfully, but these errors were encountered:
Roblox-ts doesn't have control over type or scope checking behaviour, we leave it up to Typescript. You can see in this playground example how it allows similar unintuitive behaviour, which errors in JS as well.
I haven't been able to find any cases where this doesn't error in JS, so I wonder if this would count as a reasonably-fixable-bug on the TypeScript side. You could try making an issue there.
In this instance an error should be thrown because the object being iterated is referencing the iteration variable in the callback for
filter
. This compiles with no error on roblox-ts@2.3.0.This example also comes from me refactoring and forgetting to change
child
toi
, and it went unnoticed until it errored in game.The text was updated successfully, but these errors were encountered: