Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript 4.3 #10642

Closed
sosukesuzuki opened this issue Apr 2, 2021 · 15 comments · Fixed by #10945
Closed

TypeScript 4.3 #10642

sosukesuzuki opened this issue Apr 2, 2021 · 15 comments · Fixed by #10945
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@sosukesuzuki
Copy link
Member

sosukesuzuki commented Apr 2, 2021

TypeScript 4.3 has been announced. See https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/ .

Status

  • typescript: typescript-eslint 4.25.0 supports TS 4.3 features. Also we merged the PR support it(Support TypeScript 4.3 #10945), but not released yet.
  • babel-ts: We've shipped TS 4.3 support in Prettier 2.3

New Syntax

get/set for type members

interface Thing {
    get size(): number
    set size(value: number | string | boolean);
}

override modifier in classes

class SpecializedComponent extends SomeComponent {
    override show() {
        // ...
    }
    override hide() {
        // ...
    }
}

static indexed signatures

class Foo {
  static [propName: string]: string | number | undefined;
}

Anything else?

@sosukesuzuki sosukesuzuki added type:enhancement A potential new feature to be added, or an improvement to how we print something lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) labels Apr 2, 2021
@sosukesuzuki sosukesuzuki pinned this issue Apr 2, 2021
@sosukesuzuki sosukesuzuki changed the title TypeScript 4.2 TypeScript 4.3 Apr 2, 2021
@dnalborczyk
Copy link
Contributor

dnalborczyk commented Apr 6, 2021

Anything else?

private functions: https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#ecmascript-private-class-elements

although, it might be already supported?

@worstpractice
Copy link

worstpractice commented Apr 8, 2021

Anything else?

private functions: https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#ecmascript-private-class-elements

although, it might be already supported?

The private class element syntax (which is actually a JavaScript language feature, and not a TypeScript language feature) seems fully supported by Prettier (atleast as of 2.2.1).

However at the time of this writing, Prettier chokes on the items listed by OP.

@pleerock
Copy link

pleerock commented Apr 9, 2021

Can we also have a better formatting of using as conditional expressions in object key signatures? For example I don't feel this looks good right now:

export type EntityPrimaryColumnValueMap<
  Entity extends AnyEntity,
  Deepness extends string = "."
> = FlatTypeHint<
  {
    [P in keyof (Entity["columns"] &
      Entity["embeds"]) as EntityPrimaryColumnValueMapAsCondition<
      Entity,
      P
    > extends true
      ? P
      : never]: P extends keyof Entity["columns"]
      ? ColumnCompileType<Entity, P>
      : P extends keyof Entity["embeds"]
      ? EntityPrimaryColumnValueMap<Entity["embeds"][P], `${Deepness}.`>
      : never
  }
>

@bobbyoz

This comment has been minimized.

@alexander-akait
Copy link
Member

@pleerock please avoid do it here, your problems is not relevant to this

@thorn0
Copy link
Member

thorn0 commented Apr 9, 2021

@pleerock I opened #10667 for that. Thanks for reporting.

@sosukesuzuki
Copy link
Member Author

Babel 7.14.0 has been released. We can support TS 4.3 via babel-ts now.

@sosukesuzuki
Copy link
Member Author

If TypeScript 4.3 is released, many users would like Prettier to support TS 4.3. Keep this issue pinned until the next release so they don't create extra issues.

@sosukesuzuki sosukesuzuki pinned this issue May 25, 2021
@sosukesuzuki
Copy link
Member Author

TypeScript 4.3 has been released https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/

@kirillgroshkov
Copy link

What's the plan to release this feature? I guess many folks are blocked with Typescript 4.3 update because of this.. 🙏

@sosukesuzuki
Copy link
Member Author

@kirillgroshkov We haven't decided on the specifics, but I think it needs to be done as soon as possible.

Also you can use the workaround with babel-ts:

{
  "overrides": [
    {
      "files": "*.ts",
      "options": {
        "parser": "babel-ts"
      }
    }
  ]
}

@adrigzr
Copy link

adrigzr commented May 28, 2021

Hi, I'm having trouble overriding an abstract property:

abstract class Foo extends Bar {
  abstract override name: string;
}

This gets "prettied" to override abstract which is incorrect:

abstract class Foo extends Bar {
  override abstract name: string;
}

I'm using babel-ts parser.

@sosukesuzuki
Copy link
Member Author

@adrigzr Thank you it is a bug, I've created the PR to fix it #10961

@akphi
Copy link

akphi commented May 31, 2021

Just curious, do we have some ETA on when this might get released?

@sosukesuzuki
Copy link
Member Author

sosukesuzuki commented Jun 5, 2021

We've released 2.3.1 that supports TS 4.3.

@sosukesuzuki sosukesuzuki unpinned this issue Jun 5, 2021
lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue Aug 19, 2021
Typescript 4.3 has the new 'override' keyword. This requires an update.
For more detail see:
prettier/prettier#10642

Change-Id: Id663a700bf3cb68be49c03dafb1938d84372dd6e
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Sep 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:typescript Issues affecting TypeScript-specific constructs (not general JS issues) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants