Declare type with implicit cast #461
-
My plan is to declare two different types (vec2 and vec3) and use in both the cases the luau vector type.
I have also tried to add two entries to exportedTypeBindings with the same TypeId ("vec") but in this case when when autocompleting I'm always receiving the name setted into ClassTypeVar ("vec", not "vec2" or "vec3") |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Classes can't be implicitly converted to each other unless they share a common parent. You could model these as table types I suppose, or alternatively you can use vec2 as a parent of vec3, even though this is a little odd, but that'd give you an ability to pass a vec3 instance to a function that expects vec2. |
Beta Was this translation helpful? Give feedback.
Classes can't be implicitly converted to each other unless they share a common parent. You could model these as table types I suppose, or alternatively you can use vec2 as a parent of vec3, even though this is a little odd, but that'd give you an ability to pass a vec3 instance to a function that expects vec2.