-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested tagged unions do not work as I want them to work #1188
Labels
bug
Something isn't working
fixed by new solver
This issue is confirmed to be fixed in the new solver.
Comments
for attributes you could make it work like this : type HealingButton = ButtonCommon & {
GetAttribute:
((ButtonCommon, "Class") -> ('Healing')),
health: IntValue,
}
type DamageButton = ButtonCommon & {
GetAttribute:
((ButtonCommon, "Class") -> ('Damage')),
damage: IntValue,
}
type ButtonCommon = Model & {}
type Button =
HealingButton |
DamageButton
local button: Button = {} :: any
-- Type Error: (24,4) Cannot call non-function (((Instance, string) -> any) & ((Model, "Class") -> "Damage")) | (((Instance, string) -> any) & ((Model, "Class") -> "Healing"))
if button:GetAttribute("Class") == 'Damage' then
-- Type Error: (26,8) Key 'damage' is missing from 'Model & {| |} & {| GetAttribute: (Model, "Class") -> "Healing", ... 1 more ... |}' in the type '(Model & {| |} & {| GetAttribute: (Model, "Class") -> "Damage", ... 1 more ... |}) | (Model & {| |} & {| GetAttribute: (Model, "Class") -> "Healing", ... 1 more ... |})'
print(button.damage)
end
|
alexmccord
added
the
fixed by new solver
This issue is confirmed to be fixed in the new solver.
label
Apr 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
fixed by new solver
This issue is confirmed to be fixed in the new solver.
in the above case , tagged unions work as expected .
in the implementation below , they do not :
here is my ideal use case :
i have to do this since there is no typechecking for attributes , perhaps if there is a way to accomplish this , i'll be thankful if you let me know .
The text was updated successfully, but these errors were encountered: