Unknown generic function parameters

Is that wrong or is it just a bug, the type of the function parameters are unknown

type Dictionary<K, V> = {[K]: V}

function TableUtil.filter<K, V>(t: Dictionary<K, V>, predicate: (value: V, key: K) -> boolean): Dictionary<K, V>
	local finalTable: Dictionary<K, V> = {}
	for k, v in t do
		if predicate(v, k) then
			finalTable[k] = v
		end
	end
	return finalTable
end


And when adding <K, V> before the predicate type it says the type is only K and V, no autocomplete whatsoever

Am i doing something wrong or is it a bug?
Edit: opened an issue - [New Solver] Generic function parameters are unknown · Issue #2002 · luau-lang/luau · GitHub

1 Like

What is the type of players? Is the type checker at least getting that variable correct?

Edit: I think it’s a bug with the new type solver. If you disable it in the beta features and use the old version, it works as expected. Might be worth creating an issue on the github if one doesn’t already exist.

2 Likes

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