How do I typecheck a value being a member of a dictionary?

I want to make it so that the IdleConnect function’s callback “func” has the argument lastState being a GuiState. I can make it a string but it would be nice it showed it’s an enum and not a string.

My code (example code, not actual code I use):

function self:Connect(func: (lastState: Enum.GuiState --[[doesnt work]]) -> nil): RBXScriptConnection
	-- functionality ...
end

local object = module.Button(...)

object.onIdle:Connect(function(lastState --[[intelisense allows you to choose Idle, Hover, Press...]])
	
end)