-
-
Notifications
You must be signed in to change notification settings - Fork 254
Typescript Plugin #320
Description
This would help tooling for other things like ESLint, prettier, and users that use both Babel and Typescript (and using either < stage 3 syntax or want to use Babel to compile). And maybe other things in the future?
Now I'm not sure anyone on the team is able to dedicate time to create or maintain the plugin (there's plenty of stuff to work on already and all as volunteers) but we can help out with questions (testing, how it works, etc). I think it would work the same as how we maintain the flow plugin. The Flow team submits PRs for upcoming features/fixes and we help to review the changes according to our style/codebase.
A new proposal requires a few changes: https://github.com/babel/babel/wiki/Adding-a-new-Proposal-to-Babel. Basically a change to the parser, the code generator (for consistency although maybe not necessary), the AST spec doc, the
AST helper functions, and to the plugin that removes the types.
We are determining what to do about spec changes/major bumps via #275. Basically a change that isn't a major bump would be a different plugin so we can just release a minor of the parser rather than a major bump.
The flow team is available to talk to us via slack/github and now we also have a #typescript room in our slack so can also discuss with the TS team and others that want to help out with this effort. (Signup at http://slack.babeljs.io/, the room url after you've signed in is https://babeljs.slack.com/messages/typescript/).
I'm going to edit this section later about the basics of implementing this but just wanted to get an issue started.
- Babylon is acorn, so the way you can do plugins is by extending certain parser methods
- https://github.com/babel/babylon/tree/master/src/plugins for flow/jsx
- find and extend the correct hooks for TS (probably similar to flow for most, need a few new ones)
- create all the helper parser methods
pp.methodHere - add to plugins
Lines 14 to 17 in b6c3b5a
import flowPlugin from "./plugins/flow"; import jsxPlugin from "./plugins/jsx"; plugins.flow = flowPlugin; plugins.jsx = jsxPlugin; - import tests from TS?
- update readme