Skip to content

Unexpected formatting of a return type in TypeScript #6886

@merlinnot

Description

@merlinnot

Prettier 1.19.0
Playground link

--parser typescript

Input:

export const getVehicleDescriptor = async (
  vehicleId: string,
): Promise<
  Collections.Parts.PrintedCircuitBoardAssembly['attributes'] | undefined
> => {}

Output:

export const getVehicleDescriptor = async (
  vehicleId: string
): Promise<| Collections.Parts.PrintedCircuitBoardAssembly["attributes"]
| undefined> => {};

Expected behavior:

export const getVehicleDescriptor = async (
  vehicleId: string,
): Promise<
  | Collections.Parts.PrintedCircuitBoardAssembly['attributes']
  | undefined
> => {}

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