prettier icon indicating copy to clipboard operation
prettier copied to clipboard

[typescript]: Missing line break with long generic parameter

Open PupoSDC opened this issue 3 years ago • 0 comments

Prettier 2.6.2 Playground link

--parser typescript
--prose-wrap never

Input:


const hermesNotificationCancellationByUserTagSchema: ZodSchema<HermesNotificationCancellationByUserTag> =
  z.object({
    userTag: z.string(),
    notificationType: z.nativeEnum(NotificationType).optional(),
  })


const hermesNotificationCancellationByUserTagSchema: ZodSchema<
  HermesNotificationCancellationByUserTag
> =
  z.object({
    userTag: z.string(),
    notificationType: z.nativeEnum(NotificationType).optional(),
  })

Output:

const hermesNotificationCancellationByUserTagSchema: ZodSchema<HermesNotificationCancellationByUserTag> =
  z.object({
    userTag: z.string(),
    notificationType: z.nativeEnum(NotificationType).optional(),
  });

const hermesNotificationCancellationByUserTagSchema: ZodSchema<HermesNotificationCancellationByUserTag> =
  z.object({
    userTag: z.string(),
    notificationType: z.nativeEnum(NotificationType).optional(),
  });

Expected behavior:

Im not sure if this is intentional, but I would expect both calls to end up as the second input (or a variation of it), and not as the first, as the first one violates the maximum line length.

PupoSDC avatar May 24 '22 10:05 PupoSDC