refactor(types): extract inline anonymous types into named classes
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:
parent
b06249f101
commit
ff197c1f7c
5 changed files with 123 additions and 45 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue