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

support TS 4.3 static index signature in class #13096

Merged
merged 11 commits into from Apr 6, 2021
Merged

support TS 4.3 static index signature in class #13096

merged 11 commits into from Apr 6, 2021

Conversation

g-plane
Copy link
Contributor

@g-plane g-plane commented Apr 3, 2021

Q                       A
Minor: New Feature? Yes
Tests Added + Pass? Yes
License MIT

Reference: https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#static-index-signatures

Allow:

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

@babel-bot
Copy link
Collaborator

babel-bot commented Apr 3, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45050/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 3, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit df0a593:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo nicolo-ribaudo added area: typescript pkg: parser PR: New Feature 🚀 A type of pull request used for our changelog categories labels Apr 3, 2021
@g-plane g-plane changed the title support TS static index signature in class support TS 4.3 static index signature in class Apr 3, 2021
@nicolo-ribaudo
Copy link
Member

For the tests failure, you can run make test-typescript-update-allowlist.

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

After that this PR is merged, would you then like to open a new PR to use the InvalidModifiersOrder error for

class A {
  readonly static foo = 2;
}

?

Currently it just throws "unexpected token" (repl).

packages/babel-parser/src/plugins/typescript/index.js Outdated Show resolved Hide resolved
@nicolo-ribaudo
Copy link
Member

Oh also, could you rebase this on top of https://github.com/babel/babel/tree/feat-7.14.0/parser-updates? 🙏

I'm using that branch for all the parser PRs for 7.14.0, to avoid merge conflicts when we'll merge all the PRs for the release.

@existentialism existentialism mentioned this pull request Apr 6, 2021
9 tasks
@nicolo-ribaudo nicolo-ribaudo changed the base branch from main to feat-7.14.0/parser-updates April 6, 2021 15:17
@nicolo-ribaudo
Copy link
Member

make test-typescript-update-allowlist 🙏

@nicolo-ribaudo nicolo-ribaudo merged commit 72169cd into babel:feat-7.14.0/parser-updates Apr 6, 2021
@g-plane g-plane deleted the ts-4.3-static-index-signature branch April 7, 2021 01:27
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants