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

feat(gatsby-plugin-typescript): add support for optional chaining and nullish coalescing operator #19302

Merged
merged 6 commits into from
Nov 12, 2019

Conversation

Austaras
Copy link
Contributor

@Austaras Austaras commented Nov 6, 2019

Description

TS 3.7 has been released which supports optional chaining and nullish operator. gastby-plugin-typescript uses babel to transform TypeScript so two plugin must be added accordingly to support these new feature

@Austaras Austaras requested a review from a team as a code owner November 6, 2019 09:36
@lannonbr lannonbr changed the title chore(typescript): support TypeScript 3.7 chore(gatsby-plugin-typescript): support TypeScript 3.7 Nov 7, 2019
@pieh
Copy link
Contributor

pieh commented Nov 8, 2019

I think this is ok for us to use, but I do wonder if @babel/preset-typescript wouldn't be more correct place to declare those plugins?

In any case I'll do some testing and will go forward with this

@pieh pieh changed the title chore(gatsby-plugin-typescript): support TypeScript 3.7 feat(gatsby-plugin-typescript): add support for optional chaining and nullish coalescing operator Nov 8, 2019
@Austaras
Copy link
Contributor Author

Austaras commented Nov 8, 2019

I think this is ok for us to use, but I do wonder if @babel/preset-typescript wouldn't be more correct place to declare those plugins?

It is. But it seems that @babel/preset-typescript insists on type striping only. So from day one, to make TypeScript transform work babel plugins for class field and jsx are needed but they are in gatsby's babel preset. Actually plugin for decorator is also needed but few people use them in react world anyway.

In this case, TSC supports every stage-3 proposal and @babel/preset-env supports everything stage-4. To make up for this difference maintenance is always needed everytime a proposal enters or leaves stage-3

@pieh
Copy link
Contributor

pieh commented Nov 8, 2019

It is. But it seems that @babel/preset-typescript insists on type striping only. So from day one, to make TypeScript transform work babel plugins for class field and jsx are needed but they are in gatsby's babel preset. Actually plugin for decorator is also needed but few people use them in react world anyway.

I would expect @babel/plugin-transform-typescript to be one that just strips types, and preset would be one that tries to make it as 1to1 to tsc as possible. In any case, I don't have enough context on this to pretend I understand all the nuance and stances that @babel need to handle, so handling it here is fine for me.

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants