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

Docs: Difference between esnext, es6, es2015 module targets #24082

Open
bcherny opened this issue May 12, 2018 · 6 comments

Comments

@bcherny
Copy link

commented May 12, 2018

Search Terms

esnext, es6, es2015, module, tsconfig, tsconfig.json, difference, document

Suggestion

It would be great if this can be documented. On the face of it, the output for all three seems to be identical.

Related: It would also be nice to document why targeting module: "none" when your code is a module (ie. uses ES2015 imports/exports) generates CommonJS-compatible code instead of exporting to globals as "none" seems to imply.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

commented May 12, 2018

To just answer the question, the difference is that import() expressions are understood in esnext, but not in es2015 (and as of TypeScript 2.9, import.meta is only understood with esnext).

I guess you could possibly expect an es2019 module target for both.

@mhegazy

This comment has been minimized.

Copy link

commented May 14, 2018

in addition to what @DanielRosenwasser mentioned, esNext is just a place holder for features that are on the standard track but is not in an official ES spec yet. e.g. import.meta and import() expressions. as TC39 adds these features to a versioned spec, we will add a new --module ES20** to reflect that.

Also es6 === es2015.

@qm3ster

This comment has been minimized.

Copy link

commented Aug 29, 2018

Is there a place where I can see the list of https://github.com/tc39/proposals syntax supported?
(As opposed to module target or libs.d.ts?)

@zoltan-nz

This comment has been minimized.

Copy link

commented Jan 6, 2019

You can find all the libs and supported features in this folder: https://github.com/Microsoft/TypeScript/tree/master/lib

@gilamran

This comment has been minimized.

Copy link

commented Mar 11, 2019

The only place that I found for understanding TS support is here, but this table is misleading... "red" doesn't mean that TS doesn't support the feature, it means that it doesn't run on previous version of JavaScript... yea, misleading.

Can we create a similar solution for TS, but with real supported/unsupported table? (With relation to the target)

@ayqy

This comment has been minimized.

Copy link

commented Mar 26, 2019

Is there someone who can give a detail explanation for module: "none" ?
ref: Difference between typescript module “None” and “CommonJS”

@EqualMa EqualMa referenced this issue Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.