Skip to content

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

Description

TypeScript Version: 3.9.2

Search Terms:
Annotate with type from JSDocs, JSDocs, Template (@template), multiple Template (@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 (@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 (@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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions