
Company News
Socket Joins the OpenJS Foundation
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.
flow-typestrip
Advanced tools
Status](https://travis-ci.org/fkling/flow-typestrip.svg?branch=master)](https://travis-ci.org/fkling/flow-typestrip)
flow-typestrip is a recast based transform to remove Flow type annotations from typed JavaScript code, so that the code can be executed in JavaScript environments.
Alternatives: react-tools also strips type annotations.
flow-typestrip is currently not able to process files with type aliases, declarations and interfaces, because these nodes lack support in ast-types. A pull request to add support is out.
If you need support for this now, you should use react-tools instead.
$ npm install [-D] flow-typestrip
flow-typstrip comes with a command-line interface that can be used when installed globally. Here is how to convert a single file and print to stdout:
$ flow-typestrip source.js
To compile many files at once, specify an output directory:
$ flow-typestrip -o dist src/**/*.js
To enable source maps for this files, add the --source-maps flag.
var flowStrip = require('flow-typestrip');
var result = flowStrip.compile(source, {
sourceFileName: 'example.js',
sourceMapName: 'example.js.map'
});
fs.writeFileSync('result.js', result.code);
fs.writeFileSync('result.js.map', JSON.stringify(result.map));
flow-typestrip can directly be used with browserify:
$ browserify -t flow-typestrip script.js
If you look at the main transform function, it is very simple. To ensure that the types are stripped correctly, I'm using the unit tests from jstransform.
FAQs
A Recast based transform to remove Flow type annotations.
The npm package flow-typestrip receives a total of 4 weekly downloads. As such, flow-typestrip popularity was classified as not popular.
We found that flow-typestrip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.