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
{{ message }}
Repository navigation
Mapped types: field access and 'Type T not found' errors #925
Mapped types like Pick<T, K> show errors and don't resolve fields correctly for direct access.
Reproduction
---@aliasPick<T, K extends keyof T> { [P in K]: T[P]; }---@paramv{name: string, age: number}localfunctionuse_person(v)
print(v.name) -- Field access works inside functionprint(v.age)
end---@typePick<{name: string, age: number, email: string}, "name" | "age">localpickeduse_person(picked) -- No error here (type compatibility works)print(picked.name) -- ERROR: Undefined field `name`
Observed Behavior
[type-not-found]Type 'T' not found error on the @alias Pick<T, K extends keyof T> line
[undefined-field]Undefined field 'name' when accessing picked.name directly
Type compatibility for function parameters appears to work (no error on use_person(picked))
Expected Behavior
No "Type T not found" error on the alias definition
Field access on mapped type variables should resolve correctly (e.g., picked.name should be string)
Environment
emmylua_ls version: 0.19.0
Editor: Neovim
Notes
The unit tests in generic_test.rs (test_type_mapped_pick, test_type_partial) only verify type compatibility via function parameters, not direct field access. This may explain why the feature appears to work in tests but not in practice.
Activity
fix: EmmyLuaLs#925