Skip to content

refactor(deprecations): type annotations using table proxying#1964

Open
pynappo wants to merge 8 commits into
nvim-neo-tree:mainfrom
pynappo:better-deprecations
Open

refactor(deprecations): type annotations using table proxying#1964
pynappo wants to merge 8 commits into
nvim-neo-tree:mainfrom
pynappo:better-deprecations

Conversation

@pynappo

@pynappo pynappo commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

Introduces a util that creates a new table that "proxies" the original one w/ metatable magic (basically the proxy table is a tree where each node contains the full list of keys to access it, and tree nodes are generated on-demand)

This way we can do some type casting and be able to more easily migrate things like:

local old = proxy.new(config) --[[@as config.old]]
local new = proxy.new(config) --[[@as config]]

-- no need to check intermediate fields when accessing the proxy
if proxy.get(old.deprecated_config_field.nested_field) then
  proxy.set(new.new_config_field.new_nested_field, old.deprecated_config_field.nested_field)
end

Not sure about performance but DX should be way better than typing in dot-delimited string index paths into raw strings with no typing hints

@pynappo pynappo changed the title refactor(deprecations): better refactor(deprecations): type annotations using table proxying Jan 8, 2026
@pynappo pynappo force-pushed the better-deprecations branch from fa6fdc6 to f7c6f5f Compare January 12, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant