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
When using the studio companion plugin, the Instance.Name string literal is currently discarded and therefore never able to be taken advantage of for type refinement.
Suppose I have two models in the workspace, foo and bar, and a function that accepts either one of them.
typefoo=typeof(workspace.foo)
typebar=typeof(workspace.bar)
localfunctionbaz(model: foo | bar)
ifmodel.Name=="foo" then-- model's type is `foo | bar`, should be `foo`else-- model's type is `foo | bar`, should be `bar`endend
In order to differentiate foo from bar at runtime, you'd use their names - that's sorta the point. However, the typechecker is unable to use this information since the .Name property is typed as just string.
The text was updated successfully, but these errors were encountered:
When using the studio companion plugin, the
Instance.Name
string literal is currently discarded and therefore never able to be taken advantage of for type refinement.Suppose I have two models in the workspace,
foo
andbar
, and a function that accepts either one of them.In order to differentiate
foo
frombar
at runtime, you'd use their names - that's sorta the point. However, the typechecker is unable to use this information since the.Name
property is typed as juststring
.The text was updated successfully, but these errors were encountered: