I have written a simple Vector3 class in assemblyscript. The code compiles just fine but the typescript syntax highlighter naturally doesn't understand the operator overloads. Is there a way for typescript to resolve the type from assemblyscript operator overloading?
Code:
const a = new Vector3()
const b = new Vector3()
const c = a + b //red squigglies
//escape hatch method - works but unideal
//@ts-ignore
const d = <Vector3>a + b
Error Message:
Class Definition:
export class Vector3{
x: f32
y: f32
z: f32
constructor(x: f32 = 0, y: f32 = 0, z: f32 = 0){
this.x = x
this.y = y
this.z = z
}
@operator('+')
__op(other: Vector3): Vector3 {
return new Vector3(
this.x + other.x,
this.y + other.y,
this.z + other.z
)
}
}