This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Document JSDoc imports with generics #1106
Comments
Thank-you, this helped me loads after a lot of searching. I'm new to JSDoc and using vscode. Another gotcha for me was that this restricts The following makes Bob generic too:
The following makes Bob generic and also adds a
It also seems like the second param on the type def is optional, as the following also works for me:
I assume these aren't defects, but I found this quite confusing and additional documentation might help? |
Thanks for clarifying some of those points @andrewrlee, I ran into some of those issues as well. |
@gregtatum wow thank you so much!! 👏👏 👏 |
/** line 3
* @template T
* @typedef {import('./node').Node<T>} Node
*/
. . .
/ ** // line 15
* @template T
* @type {Node<T> | undefined}
*/
this.head = undefined // line 16 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The JSDoc types do not include an example of importing a type with a generic.
e.g. this is the correct way:
I won't enumerate the wrong ways I tried :D
It took me a good hour to figure it out, with lots of searching. I could not find any examples anywhere in the docs, nor in Stack Overflow. I figured someone else could benefit from my confusion.
The text was updated successfully, but these errors were encountered: