Skip to content

Add parentheses for TSTypeQuery in some case #13546

@fisker

Description

@fisker

Prettier 2.7.1
Playground link

--parser typescript

Input:

a as (typeof node.children)[number]

a as (typeof node.children)[]

a as ((typeof node.children)[number])[]

Output:

a as typeof node.children[number];

a as typeof node.children[];

a as typeof node.children[number][];

Expected behavior:

Same as input

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood fist issue!lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions