Skip to content

Multiline JSDoc Types #16179

Closed
Closed

Description

@mjbvz

From microsoft/vscode#27777

Issue
For the javascript:

/**
 * @param {{
 *  z: number
 * }} x
 */
function foo(x){}

The type of x is any. It seems multiline types are not recognized in jsdocs

There seems to be some debate about whether this is supported or not: jscs-dev/node-jscs#245 but it seems closure and some other tools support the multiline syntax

Also tracking syntax highlighting for this case here: microsoft/TypeScript-TmLanguage#467

Activity

  1. added this to the milestone on Jun 1, 2017
  2. seanf commented on Jan 19, 2018

    @seanf

    As a workaround, it may help to delete the leading * characters on the lines in between {{ and }}. Assuming your linter will let you.

  3. rob2d commented on Jun 15, 2018

    @rob2d

    Sean Flanigan (@seanf) did not seem to help in my use-cases; would be great if this were built in without needing an explicit linter (since jsdoc technically already accepts multiline params)

  4. sandersn commented on Jun 15, 2018

    @sandersn
    Member

    rob2d can you post an example of the code you couldn't get to work? I tried Matt Bierner (@mjbvz)'s example, and after deleting the leading asterisks, the type works:

    /**
     * @param {{
       z: number
      }} x
     */
    function foo(x){  x.z }

    Not skipping leading asterisk is a known bug #23667. You may have found a different bug.

  5. weswigham commented on Nov 6, 2018

    @weswigham
    Member

    AFAIK this is fixed now.

  6. nomaed commented on Jan 4, 2019

    @nomaed

    Wesley Wigham (@weswigham) is it?

    With VSCode Version 1.30.1:

    screen shot 2019-01-04 at 11 54 12

  7. weswigham commented on Jan 4, 2019

    @weswigham
    Member

    AFAIK the syntax highlighting is still waiting on atom/language-javascript#515

  8. nomaed commented on Jan 4, 2019

    @nomaed

    Yes, I found this link a bit after asking about it. Thanks!

  9. RodrigoTomeES commented on Jan 8, 2024

    @RodrigoTomeES

    hi

    I found an issue with the multi-line JSDoc but I don't know if this will be here or I need to create another issue because it's related with multi-line JSDoc Types.

    The bug is that if you use multi-line the type is not inferred but if I put all in one line the type is inferred.

    Screen.Recording.2024-01-08.at.09.17.20.mov
  10. sandersn commented on Jan 9, 2024

    @sandersn
    Member

    Please do file a new bug. This one tracked the addition of the feature, not bugs with it.

    When you do, can you provide the text of your program or a link to the typescript playground with your program included?

  11. loganmzz commented on Oct 29, 2025

    @loganmzz

    Nathan Shively-Sanders (@sandersn) I don't understand your remark, the question is about to support multiline declaration of types and it just doesn't work... So current issue is just not 'done' 🤔

  12. RyanCavanaugh commented on Oct 29, 2025

    @RyanCavanaugh
    Member

    Please do file a new bug

  13. locked as resolved and limited conversation to collaborators on Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Domain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issueIn DiscussionNot yet reached consensusSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions