Skip to content
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

Vector3/CFrame/Vector2 math overloads fail to account for union types #510

Closed
jheinem1 opened this issue Jan 7, 2022 · 0 comments
Closed

Comments

@jheinem1
Copy link

jheinem1 commented Jan 7, 2022

Typings for methods such as Vector3.mul don't appear to account for unions of valid types, e.g. number | Vector3 as opposed to just number or Vector3 (both of which are valid).

Calling these methods with unions that only contain valid types should probably be considered valid, e.g. Vector3.one.mul(condition ? Vector3.one : 1); should not throw a type error because the method could only be called with a valid type as the argument in this case.

Here is a playground link demonstrating the behavior: https://roblox-ts.com/playground/#code/PTAEBUAsFMGdtAFwO4HtQEMBOCBuGAbASwBMAoANWgGNFUsBmAOgC9otUmBbAVwIAoGASgDcoEKH68CiIgAcCATyIA7AOagABlVr0GoAFSgVPLgCN2moZRp1Grdp2n8dd5qhXQh4sFL6yFZXUtVz1DUFDGKzIyCSgiWFBYSFQ+ElALUHxidItqDB54ENs9bj5NUHyVTGpqaDlEUGgiRBgsTGNTC3b6DsiGAFpKniwcFUQlUBIE6iwiLlUMRDhMNQxVWEbWhB4VIg8kRTkETRNzdlAAHwiSqJtdezYOMoFELB4EAH5QAEZQAC4bg93J5RDEJABleZEAjYDLQSAYXD7doJJoAD0gRDMLWg6VUSBgU2gADNVC19ipEqgSUw6bEwABhABiWAwXDgZE8yFALLZHP4Qhe-DeH1A336Dg4AOM0B5fPZXhEDKBdgATLB7uqpU4+CL3l9fjLImqmB4lUA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant