Skip to content

[typescript] doc comments on function type signatures get moved to invalid places #10260

@tao-cumplido

Description

@tao-cumplido

Prettier 2.2.1
Playground link

--parser typescript

Input:

type A = (
    /** @deprecated */
    () => void
);
  
type B = (
	/** @deprecated */
	new () => void
);
  
type C = (
	/** @deprecated */
	<T>() => void
);
    
type D = (
	/** @deprecated */
	new <T>() => void
);

Output:

type A = () => /** @deprecated */
void;

type B = new () => /** @deprecated */
void;

type C = /** @deprecated */
<T>() => void;

type D = new /** @deprecated */
<T>() => void;

Expected behavior:
Preserve the doc comment in a valid position. The doc comment has to start on a new line to be recognized by TS (playground link).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:commentsIssues with how Prettier prints commentshelp wantedWe're a small group who can't get to every issue promptly. We’d appreciate help fixing this issue!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