dprint-plugin-typescript icon indicating copy to clipboard operation
dprint-plugin-typescript copied to clipboard

Formatting Assigned Large Generic Types on New Line

Open harrysolovay opened this issue 2 years ago • 0 comments

I have a max width of 100 and wrote the following:

export type EnsureKnownLookup<T, L extends { [N in NetworkName]: T }> =
  EnsureLookup<NetworkName, T, L>;

Upon applying dprint, the line above becomes the following:

export type EnsureKnownLookup<T, L extends { [N in NetworkName]: T }> = EnsureLookup<
  NetworkName,
  T,
  L
>;

I can also format it like so:

export type EnsureKnownLookup<
  T,
  L extends { [N in NetworkName]: T },
> = EnsureLookup<NetworkName, T, L>;

However, neither are (imo) as clean nor legible as the initial. Is there a correct way to get dprint to respect the initial format (ideally without ignoring the line, changing the max width, etc.)?

harrysolovay avatar Jun 18 '22 20:06 harrysolovay