Skip to content

Annotate with type from JSDocs generates a line break between generics instead of a comma #38868

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
VitorLuizC opened this issue May 31, 2020 · 1 comment · Fixed by #39621
Closed
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@VitorLuizC
Copy link

VitorLuizC commented May 31, 2020

TypeScript Version: 3.9.2

Search Terms:
Annotate with type from JSDocs, JSDocs, @template, multiple @template values, line breaks between generics

Expected behavior:
Generates a comma and a space between generics when click on "Annotate with type from JSDocs" and has multiple @template values.

/**
 * @typedef Either
 * @template L, R
 */

/**
 * @param {function(R): boolean} predicate
 * @param {function(R): L} onLeft
 * @returns {function(R): Either.<L, R>}
 * @template L, R
 */
function fromPredicate<L, R>(predicate: (arg0: R) => boolean, onLeft: (arg0: R) => L): (arg0: R) => Either<L,R> {}

Actual behavior:
Generates a line break between generics when click on "Annotate with type from JSDocs" and has multiple @template values.

/**
 * @typedef Either
 * @template L, R
 */

/**
 * @param {function(R): boolean} predicate
 * @param {function(R): L} onLeft
 * @returns {function(R): Either.<L, R>}
 * @template L, R
 */
function fromPredicate<L
R>(predicate: (arg0: R) => boolean, onLeft: (arg0: R) => L): (arg0: R) => Either<L,R> {}

Related Issues:
I coudn't find a similar issue.

Code

/**
 * @typedef Either
 * @template L, R
 */

/**
 * @param {function(R): boolean} predicate
 * @param {function(R): L} onLeft
 * @returns {function(R): Either.<L, R>}
 * @template L, R
 */
function fromPredicate(predicate, onLeft) {}
Output
"use strict";
/**
 * @typedef Either
 * @template L, R
 */
/**
 * @param {function(R): boolean} predicate
 * @param {function(R): L} onLeft
 * @returns {function(R): Either.<L, R>}
 * @template L, R
 */
function fromPredicate(predicate, onLeft) { }
Compiler Options
{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "declaration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "moduleResolution": 2,
    "target": "ES2017",
    "jsx": "React",
    "module": "ESNext"
  }
}

Playground Link: Provided

@DanielRosenwasser
Copy link
Member

Thanks @a-tarasyuk!

@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Jul 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
3 participants