Linter: EnumItem Not Recognized as Data Type

Reproduction Steps
In any script, check equality between the type of something and “EnumItem”. “EnumItem” will be flagged by the linter as “Unknown type ‘EnumItem’ (expected primitive or userdata type)”. The result of typeof(EnumItem) is “EnumItem”, therefore it is a valid data type.

An example:

local isEnumItem = typeof(Enum.ProductPurchaseDecision.PurchaseGranted) == "EnumItem";

Expected Behavior
The linter should recognize that EnumItem is a valid data type.

Actual Behavior
The linter shows a warning that EnumItem is not a valid data type.

Issue Area: Studio
Issue Type: Other
Impact: Low
Frequency: Constantly
Date First Experienced: 2021-06-19 12:06:00 (-04:00)
Date Last Experienced: 2021-06-19 12:06:00 (-04:00)

6 Likes

I can confirm this behavior occurs on my end too.

1 Like

Pretty sure you’re suppposed to check if it’s an Instance rather than an EnumItem

1 Like

This is incorrect, shown here you can see typeof(Enum.ProductPurchaseDecision.PurchaseGranted) returns “EnumItem”, while typeof(workspace) returns “Instance”. EnumItem is its own unique data type, and always has been.

5 Likes

Sorry about that! A fix will be coming to you in the 485 release.

6 Likes

This topic was automatically closed after 6 days. New replies are no longer allowed.