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

Function exported as variable despite @function tag #858

Closed
jerylvaz opened this issue Sep 19, 2018 · 4 comments
Closed

Function exported as variable despite @function tag #858

jerylvaz opened this issue Sep 19, 2018 · 4 comments

Comments

@jerylvaz
Copy link

v2.7.2

/**
 * Promisified version of fs.writeFile().
 * @function writeFileAsync
 */
export const writeFileAsync: Function = util.promisify(fs.writeFile);

typedoc

CLI options:
--readme ./README.md --mode file --includeDeclarations --excludePrivate --excludeExternals

@aciccarello
Copy link
Collaborator

Hello @jerylvaz, in general, TypeDoc does not override type information from jsdoc tags. The @function tag is not officially supported. Since the variable is defined as a const TypeScript considers it a variable with a function signature. I wonder if it would make sense to tag callable variables as functions.

@justinfagnani
Copy link

I wonder if it would make sense to tag callable variables as functions.

This is definitely what I'd want.

@Ixonal
Copy link

Ixonal commented Dec 20, 2018

I'm running into this too. The documentation generated shows the whole function implementation when I set up memoization...

/**
 * Determines whether or not the given string can be considered a url
 */
export const isUrl = memoize(
  function isUrl(str: string): boolean {
    urlParser.href = str;
    return !!(urlParser.host && urlParser.host !== window.location.host);
  }
);

It may be of benefit to officially support the @function annotation for this specific situation...

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 26, 2020

In 0.20, TypeDoc renders the OP's code block as the following:

image

Removing the (bad) type annotation : Function, results in rendering this:

image

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

5 participants