re: JavaScript Modules VIEW POST

TOP OF THREAD FULL DISCUSSION
re: That's still in flux and most of the libraries out there are written in something else so there is still a lot of tooling required to recompile and...
 

I agree with @nektro , the standard is ES6 modules, it's just that some haven't caught up with it yet. Due also to the inane amount of tooling that was written before and retro-compatibility (many JS libraries still support all the module options under the sun in their shipped code).

I'm optimistic about the future of modules, it's just going to take a little time.

Babel deserves a second look though, because in the future it will be less about translating code (browsers are catching up with native features) and more about allowing people to use "future" features in the present. I find it an interesting project, more than webpack to be honest.

Currently typescript gives me all the future features and rollup handles the bundling. It's working out better than I expected.

I'm talking about these features, like the pipeline operator.

Are they in TypeScript?

Class properties, decorators, default exports/re-exports, namespaces, numeric separators, and a few more are all there.

TypeScript has a few things that are actually not in that list like boilerplate constructors for declaring instance variables and null removal without if checking, e.g.

class A {
  constructor(readonly i?: SomeType) { }
}
const iValue = (new A(123)).i!;

If the pipeline makes it to the standard then it will show up in TypeScript but it is consistently ahead of the standard so I usually get all the nice features before they even end up in the standard.

code of conduct - report abuse