Hey there, I haven’t really used typechecking in roblox yet. So I am pretty bad at it. I am working on a script but while requiring my module I am having a hard time defining a type to the variable that requires the module. Here is the code thus far:
--!strict
--// Services
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--// Modules
local Modules: Folder = RS.Modules
local BigNum = require(Modules:FindFirstChild("BigNum"))
local Formatter = require(Modules:FindFirstChild("Formatter"))
--//Functions
local function IsLessThan(n1: number | string, n2: number | string)
local Big1 = BigNum.new(n1)
local Big2 = BigNum.new(n2)
return BigNum.lt(Big2, Big1)
end
local function SetText(Label: TextLabel, NewVal: string)
if IsLessThan(999, NewVal) then
Label.Text = NewVal
else
Label.Text = Formatter.Format(tonumber(NewVal), 2)
end
end
Also, how would I specify the type of a BigNum.new()