镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

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

Activity

  1. orta commented on Jul 15, 2019

    @orta
    Contributor

    Weird, looks like the prettier playground doesn't have this problem.

    The new playground will go back to the built-in TS formatter, so you're welcome to look at maybe updating the prettier for this playground in the meantime.

  2. orta commented on Oct 3, 2019

    @orta
    Contributor

    Moving back to the TS formatter fixed this 👍

  3. jcalz commented on Oct 3, 2019

    @jcalz
    Author

    Playground link still looks bad to me; so does staging... is there some website/playground release schedule or some other thing I'm missing?

  4. orta commented on Oct 3, 2019

    @orta
    Contributor

    It's on this PR: #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions