About

Converts Flow library definitions to Bucklescript interfaces
retyped Usage: $ retyped ...files Examples: $ retyped file1.js file2.js file3.d.ts [boolean]

Examples

declare module 'numbers' {
  declare export var x: number

  declare export function add(
    a: number,
    b: number
  ): number
}

declare module 'array_math' {
  declare export function sum(nums: number[]): number
  declare export function sum2(nums: [number, number]): number
}

declare module 'union-types' {
  declare type Options = {
    first: string,
    last: string
  }

  declare export function apply(
    value: number,
    options: string | Options
  ): string
}

declare module 'optional-params' {
  declare type AddOptions = {
    times: number,
    format: string | number
  }

  declare export function add(
    first: number,
    second: number,
    options?: AddOptions
  ): number
}

        

declare module 'classes' {
  declare type State = {
    id: number,
    storeName: string
  };

  declare export class Store {
    constructor(initialState: State): Store;
    state: State;
    update(nextState: State): void;
  }
}

Demo

Is it ready?