Giter Site home page Giter Site logo

aaronngray / babel-plugin-flow-to-typescript-old Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kiikurage/babel-plugin-flow-to-typescript

0.0 1.0 0.0 782 KB

Babel plugin to convert Flow code into TypeScript

Home Page: https://www.npmjs.com/package/babel-plugin-flow-to-typescript

License: MIT License

TypeScript 100.00%

babel-plugin-flow-to-typescript-old's Introduction

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 ... ...

babel-plugin-flow-to-typescript-old's People

Contributors

aaronngray avatar dependabot[bot] avatar diskshima avatar jmhain avatar kiikurage avatar leko avatar nissy-dev avatar rgoldfinger-quizlet avatar swansontec avatar ykikura-indeed avatar zxbodya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.