luau
luau copied to clipboard
`vectors` may be incorrectly passed to functions that accept `{ x: number, y: number, z: number }`
Looks like somewhere vectors might be treated as { x: number, y: number, z: number } instead of as a readonly version of that shape?
This means this code doesn't throw any TypeErrors although it blows up at runtime:
--!strict
type vec3 = {
x: number,
y: number,
z: number
}
local function increment(v: vec3)
v.x += 1
v.y += 1
v.z += 1
return v
end
local v2 = increment(vector.create(1, 2, 3))