Skip to content

Playground: code formmating broken with TS3.4+ readonly notation #32

@jcalz

Description

@jcalz

Code:
Looks like the readonly modifier for arrays breaks code reformatting in the Playground.

// comment out to allow reformatting
const oops: readonly number[] = [1, 2, 3];
/*
SyntaxError: "',' expected. (2:22), parser-typescript.js
> 2 | const oops: readonly number[] = [1, 2, 3];
    |                      ^
*/

// Alt + Shift + F: IT DOES NOTHING!!!
const 
x 
= 
1;

Expected behavior:
Code reformats (so const x = 1; is moved to a single line)

Actual behavior:
Code does not reformat. A console error indicates that the readonly modifier is not expected.

Playground Link:
Playground Link

Related Issues:
microsoft/TypeScript#29435, introducing the readonly modifier for array types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions