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

[Finished] TypeScript conversion #1806

Merged
merged 35 commits into from Dec 23, 2017
Merged

[Finished] TypeScript conversion #1806

merged 35 commits into from Dec 23, 2017

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Dec 21, 2017

Everything is typed now and this is ready to be merged!

Closes #1570.

This is based off @Rich-Harris original PR #1570. @guybedford and myself have been working the last days to add missing types and make everything as smooth as possible so that we can do the transformation as soon as possible.

Why TypeScript, why now?

Cons:

  • Rollup is a JavaScript bundler that used to be able to bundle itself (nearly) without additional tools
  • Contributors already know the language

Pros:

  • TypeScript is not very difficult if you know JavaScript - basically everything you could do before is still possible using the same syntax, just some added types here and there. And with the added TypeScript plugin, Rollup can still bundle itself.
  • We NEED profound refactorings and architectural improvements, especially around the Bundle.js/Module.js complex. The internal API surface of those is HUGE and only understood by few - if at all. TypeScript allows us to make members private and define interfaces to structure the API around
  • We also want to introduce new abstraction layers that might in the end even make code splitting possible. Again, TypeScript is helping a lot here

@guybedford
Copy link
Contributor

guybedford commented Dec 22, 2017

@ankeetmaini
Copy link
Contributor

This looks amazing! I'd be lot more confident in changing the code now. Let me know if you need a ✋, I'm not a TS expert though!

@JamesHenry
Copy link

JamesHenry commented Dec 22, 2017

I am little biased, but I would strongly recommend taking this opportunity to also introduce Prettier into your toolchain, and never think about formatting ever again :) Let me know if you have any questions about it.

P.S. <3 Rollup

@eventualbuddha
Copy link
Contributor

Whoa! I didn't know about this, but I'm a big fan of TypeScript so definitely 💯 from me.

@lukastaegert lukastaegert changed the title [WIP] Finish TypeScript conversion [Finished] TypeScript conversion Dec 22, 2017
@@ -5,6 +5,7 @@ import ExecutionPathOptions from '../ExecutionPathOptions';
import SpreadElement from './SpreadElement';
import { PredicateFunction } from '../values';
import GlobalVariable from '../variables/GlobalVariable';
import { ObjectPath } from '../variables/VariableReassignmentTracker';

// TODO: 3 typing failures because AwaitExpression has no forEachReturnExpressionWhenCalledAtPath
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this case resolved now? If so the comment here can be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've removed this now.

@guybedford
Copy link
Contributor

I've just noticed that despite the "es5" target we've got in the TypeScript config, Rollup still assumes things like Map and iterator support.

Node 4 will support this and the const stuff so I was wondering if it's worth just updating the build to ES6 at this point? We can still individually pick used features based on what we deem important?

This came up in the process of trying to add downlevelIteration support for true ES5, and noticing that no Map shims were in place.

@guybedford
Copy link
Contributor

guybedford commented Dec 23, 2017

This also reduces the TypeScript browser build when minified and gzipped by 5KB.

@guybedford
Copy link
Contributor

Ok I've reverted this attempt for now.

The Buble register made this seem like it could work, but it seems that es5 can only be dropped when dropping support for Node4 I guess.

Iteration support through rollup/rollup-plugin-typescript#102 is no longer necessary though.

@lukastaegert
Copy link
Member Author

Ok, this goes into master now...

@lukastaegert lukastaegert merged commit d94db0f into master Dec 23, 2017
@lukastaegert
Copy link
Member Author

So, that's it. The next release will be a TypeScript release!

@lukastaegert lukastaegert deleted the ts-refactoring branch December 23, 2017 14:34
@dherges
Copy link
Contributor

dherges commented Jan 2, 2018

How cool is that! 🎇

@danbucholtz
Copy link

I just wanted to chime in and say you folks rock 🤘 .

Thanks,
Dan

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.

None yet

8 participants