Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forced symbol for the file with JSDoc @name returns an error that it does not exist #231

Open
lukaszpolowczyk opened this issue May 15, 2022 · 0 comments

Comments

@lukaszpolowczyk
Copy link

It is the code from the documentation (https://jsdoc.app/tags-name.html):

// @ts-check
/**
 * @name highlightSearchTerm
 * @function
 * @global
 * @param {string} term - The search term to highlight.
 */
 eval("window.highlightSearchTerm = function(term) {};")

 window.highlightSearchTerm("");

But it still returns an error:

Property 'highlightSearchTerm' does not exist on type 'Window & typeof globalThis'.ts(2339)

Live inline example - https://codesandbox.io/s/jsdoc-name-test-1u224k?file=/src/index.js (locally in VSCode there is the same error)

QUESTION: Why does @name not work? What should I replace it with?

My target code is supposed to be like this:

// @ts-check
/**
 * @name highlightSearchTerm
 * @function
 * @global
 * @param {string} term - The search term to highlight.
 */

 highlightSearchTerm("");

...because it's a function from another file, it uses in userScript, but so far even the version with window doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant