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

Clarify typescript preset/plugin scope #2399

Merged
merged 1 commit into from
May 10, 2021

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented Oct 14, 2020

Constantly we have feature requests like babel/babel#10690 babel/babel#12030 to include staged 3 features that are supported in TypeScript compilers. Since we are not making preset-typescript a preset-whatever-tsc-can-do, we should clarify this point on the docs.

Resolves babel/babel#12030
Fixes #2311

@netlify
Copy link

netlify bot commented Oct 14, 2020

Deploy preview for babel ready!

Built with commit 4ad7b23

https://deploy-preview-2399--babel.netlify.app

@nicolo-ribaudo
Copy link
Member

Note that I wouldn't be opposed to it being preset-parsing-whatever-tsc-can-parse-but-only-transforming-types, since it doesn't give us higher backward compat problems than shippedProposals, and it's closer to what people expect.

@@ -34,10 +34,15 @@ npm install --save-dev @babel/preset-typescript

### With a configuration file (Recommended)

Note that although TypeScript compiler `tsc` actively supports new JavaScript proposals such as optional chaining (`?.`), nullish coalescing (`??`) and class properties (`this.#x`), this preset does not include these features because they are not
the types syntax available in TypeScript only. We recommend using `preset-env` with `preset-typescript` if you want to transpile these features.
Copy link
Member

Choose a reason for hiding this comment

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

The following might be confusing:

this preset does not include these features because they are not the types syntax available in TypeScript only

Maybe something like:

this preset does not include these features as it is currently only meant to support the TypeScript types syntax.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The latter definitely looks better.

Co-authored-by: Brian Ng <bng412@gmail.com>
@JLHwung JLHwung force-pushed the clarify-typescript-preset-scope branch from e0a0e82 to 4ad7b23 Compare May 10, 2021 18:40
@JLHwung JLHwung merged commit fd0773d into babel:main May 10, 2021
@JLHwung JLHwung deleted the clarify-typescript-preset-scope branch May 10, 2021 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants