Skip to content

Support TypeScript 4.0 #8646

Closed
Closed

Description

@sosukesuzuki

TypeScript 4.0 beta has been released!

https://devblogs.microsoft.com/typescript/announcing-typescript-4-0-beta/

We need to support new syntaxes:

note: We should wait typescript-eslint/typescript-eslint#2260 for default TS parser and babel/babel#11760 for babel-ts parser.

Activity

  1. added
    scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency
    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)
    on Jun 26, 2020
  2. pinned this issue on Jun 26, 2020
  3. orta commented on Jun 26, 2020

    @orta
    Contributor

    Also a catch clause can legally have a type now (only : any and : unknown are allowed) - today Prettier drops it entirely

    Playground

  4. bradennapier commented on Jun 27, 2020

    @bradennapier

    Yep and it may be useful to drop if its anything other than any or unknown but may be getting more into a linting-like situation there which @typescript-eslint should instead implement.

    Def looking forawrd to this for the variadic tuples once prettier supports it :-P

    another one to look out for that isn't obvious at first:

    type ReduceNextElement<
      T extends readonly unknown[]
      // eslint-disable-next-line prettier/prettier
    > = T extends readonly [infer V, ...infer R] ? [V, R] : never

    Prettier will currently change this to

    type ReduceNextElement<T extends readonly unknown[]> = T extends readonly [
      infer V,
      ...(infer R)
    ]
      ? [V, R]
      : never;

    which produces a ts error:

    image

    Where we expect the following:

    type Check = ReduceNextElement<[1, 2, 3]>; // [1, [2, 3]]
  5. fisker commented on Jul 21, 2020

    @fisker
    Member

    Type annotations on catch clauses #8805

  6. wclr commented on Jul 29, 2020

    @wclr

    Labeled tuples not supported.

  7. fisker commented on Aug 3, 2020

    @fisker
    Member

    Labeled tuples for babel-ts #8885

  8. harrysolovay commented on Aug 9, 2020

    @harrysolovay
  9. liamcarter111 commented on Aug 21, 2020

    @liamcarter111

    Since Typescript official 4.0.2 was released to the masses yesterday, any update on when #8982 will be released?

  10. sosukesuzuki commented on Aug 21, 2020

    @sosukesuzuki
    MemberAuthor

    We are working for release 2.1(#8882), please wait.

  11. unpinned this issue on Aug 24, 2020
  12. papb commented on Aug 25, 2020

    @papb

    Hello @sosukesuzuki, I am still experiencing the issue reported by @bradennapier above, in which ...infer T is incorrectly replaced with ...(infer T). I am using Prettier 2.1.0. I will work around this with // prettier-ignore for now.

  13. bradennapier commented on Aug 25, 2020

    @bradennapier

    Figured it'd get missed ;) subtle difference but completely breaks inference.

  14. fisker commented on Aug 25, 2020

    @fisker
    Member

    Can you raise another issue? I think we missed that

  15. papb commented on Aug 25, 2020

    @papb
  16. locked as resolved and limited conversation to collaborators on Nov 24, 2020
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

    lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions