Skip to content

Commit

Permalink
fix(type): add type annotation to Path() as a function call
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 committed Feb 18, 2024
1 parent abe0572 commit e463807
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lua/pathlib/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1180,4 +1180,7 @@ function Path:fs_opendir(follow_symlinks, depth)
return next_file
end

return Path
---@type PathlibPath|fun(...: PathlibPath|PathlibString): PathlibPath
local M = Path

return M
5 changes: 4 additions & 1 deletion lua/pathlib/posix.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ function PosixPath:is_hidden()
return self:basename():sub(1, 1) == "."
end

return PosixPath
---@type PathlibPosixPath|fun(...: PathlibPath|PathlibString): PathlibPosixPath
local M = PosixPath

return M
5 changes: 4 additions & 1 deletion lua/pathlib/windows.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@ function WindowsPath:is_hidden()
return const.band(winapi.GetFileAttributesA(self:tostring()), FILE_ATTRIBUTE_HIDDEN) ~= 0
end

return WindowsPath
---@type PathlibWindowsPath|fun(...: PathlibPath|PathlibString): PathlibWindowsPath
local M = WindowsPath

return M

0 comments on commit e463807

Please sign in to comment.