Incorrect error massage with function type <T,A>(a:{[A]:T}|Instance,i:A) -> T with --!strict

When trying to index the parameter of type <T,A>{[A]:T}|Instance, there is an incorrect error message:
Expected type table, got 'Instance | { [A]: T }' instead

Reproduction:

--!strict

local function getVOfT<T,A>(a:{[A]:T}|Instance,i:A) : T
	return a[i]
end

Expected behavior

type error:
Attempting a dynamic property access on type '{[A]:T}|Instance' is unsafe and may cause exceptions at runtime

A private message is associated with this bug report

5 Likes

Hi there, sorry that this got lost! I am seeing this issue in the New Type Solver. You didn’t mention whether you had the Beta enabled or not, but we can look into fixing it for the New Type Solver, for sure.

Excuse me, yes it only happens with the new type solver.