Skip to content

Incorrect comment print #18041

@fisker

Description

@fisker

I experience a seemingly related issue:

type BufferStreamOrVoid<

  C extends undefined | Buffer | Stream | boolean,

  P extends undefined | Buffer,

  R extends Buffer | Stream | void = // Inline comment about void.

  // Above line comment about exclue.

  Exclude<C, false> extends never

    ? void

    : C & P extends Buffer

    ? Buffer

    : Stream

= R;

Results in:

type BufferStreamOrVoid<

  C extends undefined | Buffer | Stream | boolean,

  P extends undefined | Buffer,

  R extends Buffer | Stream | void = // Above line comment about exclue. // Inline comment about void.

  Exclude<C, false> extends never

    ? void

    : C & P extends Buffer

    ? Buffer

    : Stream

= R;

Notice how the inline comment ends up at the end of the above line comment.

Funny thing is, it even breaks max line length.

Originally posted by @tdolsen in #10260

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions