Skip to content

Multiline JSDoc function signatures aren't properly parsed #26846

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

Closed
tschaub opened this issue Sep 2, 2018 · 1 comment · Fixed by #26528
Closed

Multiline JSDoc function signatures aren't properly parsed #26846

tschaub opened this issue Sep 2, 2018 · 1 comment · Fixed by #26528

Comments

@tschaub
Copy link
Contributor

tschaub commented Sep 2, 2018

TypeScript Version: 3.1.0-dev.20180901

Search Terms:

  • JSDoc
  • function
  • multiline
  • asterisk

Code

/**
 * A function whose signature is very long.
 *
 * @typedef {function(boolean, string, number):
 *     (string|number)} StringOrNumber
 */

/**
 * Makes use of a function type with a long signature.
 * @param {StringOrNumber} func The function.
 * @param {boolean} bool The condition.
 * @param {string} str The string.
 * @param {number} num The number.
 * @returns {string|number} The return.
 */
function check(func, bool, str, num) {
  return func(bool, str, num)
}

Expected behavior:

tsc --pretty reports no errors.

Actual behavior:

main.js:5:8 - error TS1005: '}' expected.

5  *     (string|number)} StringOrNumber
         ~

main.js:10:12 - error TS2304: Cannot find name 'StringOrNumber'.

10  * @param {StringOrNumber} func The function.
              ~~~~~~~~~~~~~~

Related Issues:

This is a variation of #23667 and in the same family as #26027 and #26774. Also pretty similar to #25779.

@tschaub
Copy link
Contributor Author

tschaub commented Sep 2, 2018

I can address this in #26528.

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

Successfully merging a pull request may close this issue.

1 participant