Weird strict type error

When using strict type checking (--!strict), I encounter this weird type error:

This is the code:

function dictionary.find_key<K, V>(dict: Dictionary<K, V>, value: V): K?
	for k, v in pairs(dict._data) do
		if v == value then -- TypeError here
			return k
		end
	end

	return nil
end

I do not understand what this means, it seems that it fixes the problem if I ditched the type paramaters and just use any type, which I dislike:

function dictionary.find_key(dict: Dictionary<any, any>, value: any): any?

Is there any way to fix this without removing the type paramaters?

1 Like

i think value is already a ingrained variable, like Enum, so maybe change it to value1 on both mentions

1 Like