All a never is is a value that’s never expected to occur, it can’t occur. It’s impossible. All it is is a way for the type checker to infer this.
local var = "hello"
if type(var) == "string" and type(var) == "number" then
--although not shown, var is now inferred as never.
--this is because this code path is impossible. A variable can't be a string and a number at the same time.
end
You can use it to indicate certain things like a function never returning:
local function foo(): never
--indicate never because this will loop indefinitely
while true do
end
end