Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azz/types-b-gone
Convert TypeScript Code to JavaScript in-place
https://github.com/azz/types-b-gone
ast converter javascript typescript
Last synced: 2 days ago
JSON representation
Convert TypeScript Code to JavaScript in-place
- Host: GitHub
- URL: https://github.com/azz/types-b-gone
- Owner: azz
- License: mit
- Created: 2017-06-16T13:04:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-18T11:46:39.000Z (about 7 years ago)
- Last Synced: 2024-12-08T13:17:05.250Z (26 days ago)
- Topics: ast, converter, javascript, typescript
- Language: JavaScript
- Size: 31.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Don't Use This!
Awesome work is happening in babel. Check out the new [`babel-preset-typescript`](https://github.com/babel/babel/tree/master/packages/babel-preset-typescript) that does the same thing as this package, except better.
---
# Types B'Gone!
[![Build Status](https://travis-ci.org/azz/types-b-gone.svg?branch=master)](https://travis-ci.org/azz/types-b-gone)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)Converts your TypeScript code into JavaScript code in-place, in case you want drop TypeScript from your workflow.
TODO:
- [ ] Replace custom TypeScript syntax with JavaScript equavalents:- [ ] `constructor(private x) {}` :arrow_right: `constructor(x) { this.x = x }`
- [x] `enum E { x = 1, y }` :arrow_right: `const E = enum({ "x": 1 }, "y")`
- [ ] `namespace X {}`
- [ ] Anything else?- [ ] Massage out type assertions:
- [ ] `(x as X).foo()` :arrow_right: `x.foo()`
Stretch goals:
- Produce JSDoc that works with TypeScript's `--checkJs`.
- Convert from TypeScript to Flow.
- Produce `types.d.ts` file containing interfaces and types.## why?
TypeScript is great, but its always nice to be able to back-out of a tool if you decide its not the right tool for the job. Kinda similar to [flow-remove-types](https://github.com/flowtype/flow-remove-types).
## install
```bash
yarn global add types-b-gone
```
## cliSingle file:
```bash
$ types-b-gone < ./src/MyFile.ts > ./src/MyFile.js
$ rm ./src/MyFile.ts
```## api
```js
const bGone = require("types-b-gone");bGone("function f(): T {}"); // ==> "function f() {}"
```## contributing
* Tests are ran with Jest via `yarn test`.
* Linted with eslint and prettier via `yarn lint`.