npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

babel-plugin-flow-to-typescript

v0.6.0

Published

Babel plugin to convert Flow into TypeScript

Downloads

3,981

Readme

babel-plugin-flow-to-typescript

Babel plugin to convert Flow code into TypeScript

How to use

$ npm install -g @babel/cli @babel/core
$ npm install babel-plugin-flow-to-typescript

# you must use babel@^7.x.x
$ babel --version
7.4.4 (@babel/core 7.4.5)

$ babel --plugins babel-plugin-flow-to-typescript ${SRC_FLOW_FILE} -o ${DEST_TS_FILE}

Implementation status

| Supported? | Syntax | Flow | TypeScript | | ---------- | --------------------- | --------------------------------- | ----------------------------------------------- | | ✅ | Maybe type | let a:?number | let a: number \| null \| undefined | | ✅ | Void type | void | void | | ✅ | Object type | Object | object | | ✅ | Mixed type | mixed | unknown | | ✅ | Function type | (A, B) => C | (x1: A, x2: B) => C | | ✅ | Exact type | {\| a: A \|} | { a: A } | | ✅ | Indexers | { [A]: B } | { [a: A]: B } | | ✅ | Existential type | Map<*, *> | Map<any, any> | | ✅ | Opaque types | opaque type A = B | type A = B | | ✅ | Variance | interface A { +b: B, -c: C } | interface A { readonly b: B, c: C } | | ✅ | Type parameter bounds | function f<A: string>(a:A){} | function f<A extends string>(a:A){} | | ✅ | Cast | (a: A) | (a as A) | | ✅ | type/typeof import | import type A from 'module' | import A from 'module' | | ✅ | $Keys | $Keys<X> | keyof X | | ✅ | $Values | $Values<X> | X[keyof X] | | ✅ | $ReadOnly | $Readonly<X> | Readonly<X> | | ✅ | $Exact | $Exact<X> | X | | ✅ | $Diff | $Diff<X, Y> | Pick<X, Exclude<keyof X, keyof Y>> | | ✅ | $PropertyType | $PropertyType<T, k> | T[k] | | ✅ | $ElementType | $ElementType<T, k> | T[k] | | ✅ | $Shape | $Shape<T> | Partial<T> | | ✅ | Class | Class<T> | typeof T | | ✅ | typeof operator | typeof foo | typeof foo | | ✅ | JSX | - | - | | ✅ | Tuple type | [number, string] | [number, string] | | ✅ | Type alias | type A = string | type A = string | | ✅ | Flow Ignore | $FlowFixMe | any | | ✅ | Interfaces | interface X { +prop: string } | interface X { readonly prop: string } | | ✅ | Optional Members | a?.b | ... | | ✅ | Declare functions | declare function x(false): true;| function x(x0: false): true; | | ✅ | Declare Class | ... | ... |