yeah roblox luau’s typechecking is really bad and stuff like this that’s obviously a bug with very weird work arounds are so annoying. for some reason the autofill only decided it wanted to work when you manually type out the function type definitions so like,
local MATH = {}
-- Linear interpolation.
MATH.lerp = function(a, b, t)
-- Boring code...
end :: ((number, number, number) -> number)
& ((Vector2, Vector2, number) -> Vector2)
& ((Vector3, Vector3, number) -> Vector3)
MATH.lerp() -- cool
but even if you do this apparently luau’s beast of a type checker cant understand that the documentation above the function is supposed to just be applied to the overloads so for that i had to get a little more creative,
local MATH = {}
-- description1
local function func1(a : number, b : number, t : number): number end
-- description2
local function func2(a : Vector2, b : Vector2, t : number): Vector2 end
-- description3
local function func3(a : Vector3, b : Vector3, t : number): Vector3 end
-- Linear interpolation.
MATH.lerp = function(a, b, t)
-- Boring code...
end :: typeof(func1)
& typeof(func2)
& typeof(func3)
MATH.lerp() -- cool
this is such a roundabout and ridiculous work around but it does work (probably not even worth it at this point). anyways if someone finds a more efficient/cleaner way to do this lmk.