You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type A<T> = {
s: T,
n: number?,
}
local function f<T>(_a: A<T>)
return
end
f({ s = "hello", n = 1 }) -- TypeError: Type 'number' could not be converted into 'nil' in an invariant context
does not error if the table type is not generic:
type B = {
s: string,
n: number?,
}
local function g(_b: B)
return
end
g({ s = "hello", n = 1 }) -- no type error