--!strict
local a: {string} = table.create(4, "hello") --Type '{unknown}' could not be converted into '{string}'
local b: {boolean} = table.create(4, true) --same with booleans
local c: {boolean} = table.create(4, true :: boolean) --typecasting fixes error
--works for other types
local t: {number} = table.create(4, 0)
local u: {vector} = table.create(4, vector.zero)
local v: {Color3} = table.create(4, Color3.new(1, 1, 1))
1 Like
Hi there, thanks for the report! This appears to be a problem with singleton type inference interacting poorly with bidirectional typing here. The workaround you identified of casting string literals, true, and false to their primitive types is a perfectly reasonable one, but we’ll look into fixing this interaction since it’s definitely a bug. We’ll follow up when we have a fix!