Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@VitorLuizC

Description

@VitorLuizC
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.