I have a function that returns the received value without modifying anything. But when it receives a value of type "HI" (singleton), it converts it to a type string (built-in), which is different from "HI"!
--!strict
local function get(a)
return a
end
local v: "HI" = get("HI") -- TypeError: Type 'string' could not be converted into '"HI"'
I need to get rid of this error. Is this a bug, or am I missing something?
Tried setting types explicitly, getting the same result:
--!strict
local function get<t>(a: t): t
return a
end
local v: "HI" = get("HI") -- TypeError: Type 'string' could not be converted into '"HI"'
If you’re curious why is this neccessary, here’s the original issue that comes from this weird behavior.