typechecked optargs constructors for watcher and event

This commit is contained in:
Alexander Courtis
2024-11-06 16:36:14 +11:00
parent ac302ae16a
commit a7db5b29a4
11 changed files with 91 additions and 65 deletions

View File

@@ -9,7 +9,7 @@ local DirectoryLinkNode = DirectoryNode:extend()
DirectoryLinkNode:implement(LinkNode)
---@class DirectoryLinkNode
---@overload fun(opts: LinkNodeArgs): DirectoryLinkNode
---@overload fun(args: LinkNodeArgs): DirectoryLinkNode
---@protected
---@param args LinkNodeArgs

View File

@@ -13,7 +13,7 @@ local Node = require("nvim-tree.node")
local DirectoryNode = Node:extend()
---@class DirectoryNode
---@overload fun(opts: NodeArgs): DirectoryNode
---@overload fun(args: NodeArgs): DirectoryNode
---@protected
---@param args NodeArgs

View File

@@ -9,7 +9,7 @@ local FileLinkNode = FileNode:extend()
FileLinkNode:implement(LinkNode)
---@class FileLinkNode
---@overload fun(opts: LinkNodeArgs): FileLinkNode
---@overload fun(args: LinkNodeArgs): FileLinkNode
---@protected
---@param args LinkNodeArgs

View File

@@ -18,7 +18,7 @@ local PICTURE_MAP = {
local FileNode = Node:extend()
---@class FileNode
---@overload fun(opts: NodeArgs): FileNode
---@overload fun(args: NodeArgs): FileNode
---@protected
---@param args NodeArgs

View File

@@ -1,7 +1,7 @@
local Object = require("nvim-tree.classic")
local Class = require("nvim-tree.classic")
---Abstract Node class.
---@class (exact) Node: Object
---@class (exact) Node: Class
---@field type "file" | "directory" | "link" uv.fs_stat.result.type
---@field explorer Explorer
---@field absolute_path string
@@ -13,7 +13,7 @@ local Object = require("nvim-tree.classic")
---@field parent DirectoryNode?
---@field diag_status DiagStatus?
---@field private is_dot boolean cached is_dotfile
local Node = Object:extend()
local Node = Class:extend()
---@class (exact) NodeArgs
---@field explorer Explorer

View File

@@ -1,9 +1,9 @@
local Object = require("nvim-tree.classic")
local Class = require("nvim-tree.classic")
---@class (exact) LinkNode: Object
---@class (exact) LinkNode: Class
---@field link_to string
---@field protected fs_stat_target uv.fs_stat.result
local LinkNode = Object:extend()
local LinkNode = Class:extend()
---@class (exact) LinkNodeArgs: NodeArgs
---@field link_to string
@@ -12,8 +12,6 @@ local LinkNode = Object:extend()
---@protected
---@param args LinkNodeArgs
function LinkNode:new(args)
LinkNode.super.new(self, args)
self.link_to = args.link_to
self.fs_stat_target = args.fs_stat_target
end

View File

@@ -4,7 +4,7 @@ local DirectoryNode = require("nvim-tree.node.directory")
local RootNode = DirectoryNode:extend()
---@class RootNode
---@overload fun(opts: NodeArgs): RootNode
---@overload fun(args: NodeArgs): RootNode
---@protected
---@param args NodeArgs