refactor(types): extract inline anonymous types into named classes (#110)

Problem: several functions used inline `{...}` table types in their
`@param` and `@return` annotations, making them hard to read and
impossible to reference from other modules.

Solution: extract each into a named `---@class`: `pending.Metadata`,
`pending.TaskFields`, `pending.CompletionItem`, `pending.SystemResult`,
and `pending.OAuthClientOpts`.
This commit is contained in:
Barrett Ruth 2026-03-08 19:49:49 -04:00
parent 24bc1e395b
commit 34a68db6d0
5 changed files with 123 additions and 45 deletions

View file

@ -22,6 +22,17 @@ local config = require('pending.config')
---@field undo pending.Task[][]
---@field folded_categories string[]
---@class pending.TaskFields
---@field description string
---@field status? string
---@field category? string
---@field priority? integer
---@field due? string
---@field recur? string
---@field recur_mode? string
---@field order? integer
---@field _extra? table
---@class pending.Store
---@field path string
---@field _data pending.Data?
@ -264,7 +275,7 @@ function Store:get(id)
return nil
end
---@param fields { description: string, status?: string, category?: string, priority?: integer, due?: string, recur?: string, recur_mode?: string, order?: integer, _extra?: table }
---@param fields pending.TaskFields
---@return pending.Task
function Store:add(fields)
local data = self:data()