Properly auto code format on Generic and type definitions

My desired auto format is something like this

export type SequencedPostConstructParams =
PostConstructParamsNoTitle &
SequentialDocumentConstructParams & {
title: string,
}

However, after I auto format (Ctrl+Alt+L), it becomes something like this

export type SequencedPostConstructParams =
PostConstructParamsNoTitle &
SequentialDocumentConstructParams & {
title: string,
}

--------------------------------------------------

Also, I would like to format my generic to something like this

type FunctionConstructResponse<
T extends PostDocumentBaseNoTitle,
R extends PostGetResponse,
G extends PostGetResult<T>
> = (
getResult: G,
) => R;

But the current formatted result is

type FunctionConstructResponse<T extends PostDocumentBaseNoTitle,
R extends PostGetResponse,
G extends PostGetResult<T>> = (
getResult: G,
) => R;

--------------------------------------------------

How do I achieve what I want?

0
3 comments

There are no code style preferences for generics, related feature request: https://youtrack.jetbrains.com/issue/WEB-37872

0

I see. Is it possible to map a key to some command like 

eslint --fix

 

0

@RaenonX

Yes, you can set it up as an External Tools entry and assign a shortcut to it.

0

Please sign in to leave a comment.