-
Is it possible to use table with __call as function and get hints about its arguments? I can't overload class with function, right? ---@class lib.ansicolors
---@overload fun(str:string):string ... and giving function a name (id) using |
Beta Was this translation helpful? Give feedback.
Answered by
lua-rocks
Oct 11, 2021
Replies: 1 comment
-
Okay, I found not perfect, but still a solution. I can give such functions a name using ---@alias lib.ansicolors_call fun(str: string): string
...
---@type lib.ansicolors|lib.ansicolors_call
local ansicolors = require 'lib.ansicolors' The problem is that this approach does not describe the actual function in the code and requires specifying the type after each require, but it works nevertheless. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lua-rocks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay, I found not perfect, but still a solution.
I can give such functions a name using
@alias
annotation:The problem is that this approach does not describe the actual function in the code and requires specifying the type after each require, but it works nevertheless.