As of release 0.637, enums are no longer compatible with the Enum
type, causing new type errors in previously typechecked scripts. This is very likely caused by this fix mentioned at Release Notes for 637 | Documentation - Roblox Creator Hub :
Despite the fix still being marked as pending, it appears to be implemented but breaks casting to Enum
without casting it to unknown
or any
first:
local enum = Enum.KeyCode::Enum --Cannot cast 't1 where t1 = {...}' into 'Enum' because the types are unrelated
if typeof(enum) == 'Enum' then
print(enum) --incorrectly inferred as the error type
end
This breaks the following code which I used as a workaround for a different issue where before the casts to Enum
made the code typecheck correctly, but no longer does due to this issue:
Expected behavior
The types are compatible and do not cause type errors, but also include the fix for GetEnumItems()
not showing up.