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:
parent
24bc1e395b
commit
34a68db6d0
5 changed files with 123 additions and 45 deletions
|
|
@ -1,5 +1,9 @@
|
|||
local config = require('pending.config')
|
||||
|
||||
---@class pending.CompletionItem
|
||||
---@field word string
|
||||
---@field info string
|
||||
|
||||
---@class pending.complete
|
||||
local M = {}
|
||||
|
||||
|
|
@ -32,7 +36,7 @@ local function get_categories()
|
|||
return result
|
||||
end
|
||||
|
||||
---@return { word: string, info: string }[]
|
||||
---@return pending.CompletionItem[]
|
||||
local function date_completions()
|
||||
return {
|
||||
{ word = 'today', info = "Today's date" },
|
||||
|
|
@ -89,7 +93,7 @@ local recur_descriptions = {
|
|||
['2y'] = 'Every 2 years',
|
||||
}
|
||||
|
||||
---@return { word: string, info: string }[]
|
||||
---@return pending.CompletionItem[]
|
||||
local function recur_completions()
|
||||
local recur = require('pending.recur')
|
||||
local list = recur.shorthand_list()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue