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

Multiline JSDoc Types #16179

Closed
mjbvz opened this issue May 31, 2017 · 9 comments
Closed

Multiline JSDoc Types #16179

mjbvz opened this issue May 31, 2017 · 9 comments
Assignees
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue In Discussion Not yet reached consensus Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented May 31, 2017

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

@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label May 31, 2017
@mhegazy mhegazy added the Suggestion An idea for TypeScript label Jun 1, 2017
@mhegazy mhegazy added this to the Future milestone Jun 1, 2017
@seanf
Copy link

seanf commented Jan 19, 2018

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

@rob2d
Copy link

rob2d commented Jun 15, 2018

@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)

@sandersn
Copy link
Member

sandersn commented Jun 15, 2018

@rob2d can you post an example of the code you couldn't get to work? I tried @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.

@mjbvz mjbvz added the Domain: JSDoc Relates to JSDoc parsing and type generation label Jul 17, 2018
@weswigham weswigham added In Discussion Not yet reached consensus Fixed A PR has been merged for this issue labels Nov 6, 2018
@weswigham
Copy link
Member

AFAIK this is fixed now.

@nomaed
Copy link

nomaed commented Jan 4, 2019

@weswigham is it?

With VSCode Version 1.30.1:

screen shot 2019-01-04 at 11 54 12

@weswigham
Copy link
Member

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

@nomaed
Copy link

nomaed commented Jan 4, 2019

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

@RodrigoTomeES
Copy link

RodrigoTomeES commented Jan 8, 2024

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

@sandersn
Copy link
Member

sandersn commented Jan 9, 2024

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?

EnergoStalin added a commit to EnergoStalin/miru that referenced this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation Fixed A PR has been merged for this issue In Discussion Not yet reached consensus Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

8 participants