Enums are no longer compatible with the global Enum type

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:

image

Expected behavior

The types are compatible and do not cause type errors, but also include the fix for GetEnumItems() not showing up.

3 Likes

Thank you for the report.

We have reverted the change that caused these errors to be reported.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.