Replies: 1 comment
-
|
Hi, I don't know how to achieve this with full annotations, but you can get type information by using an alias like this: ---@alias CallbackFunction fun(p1: string, p2:string): string
---@param callback CallbackFunction Function to be registered
function RegisterCallback(callback) endThis works perfectly well for providing type information and autocomplete suggestions, but unfortunately doesn't allow you to add comments to the function parameters. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am struggling to correctly define/annotate a callback function - I've searched the web (and here), but I did not find any way to define a function including its parameter annotations, then use this as part of another functions parameter.
Here is what is working:
However, this does not provide full parameter information (i.e. the individual parameter descriptions) when doing code completion or code hints for the
RegisterCallbackfunction. So I was trying to define the function normally, then use it as a type:This is (obviously) not working, as
CallbackFunctionis not a type - so it can't be used in the parameter list of theRegisterCallbackfunction. But this describes the use case I have...Here is what I can see in VSCode for the above try:

Any hint on how function parameters with full annotations can be defined would be highly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions