rrdelaney / ReasonablyTyped

:diamond_shape_with_a_dot_inside: Converts Flow and TypeScript definitions to Reason interfaces
https://rrdelaney.github.io/ReasonablyTyped/
MIT License
518 stars 24 forks source link

Duplicate types #1

Closed rrdelaney closed 7 years ago

rrdelaney commented 7 years ago

Right now union types are converted to names types in the same scope as the declaration. This can cause an output to have a duplicate typename. This needs to be looked for and eliminated.

Example:

declare module 'test' {
  declare function add (x: number | string, y: number | string): number
}

turns into

type number_or_string = 
| Number (float)
| String (string);

type number_or_string = 
| Number (float)
| String (string);
external add : number_or_string => number_or_string => float = "" [@@bs.module "test"];
rrdelaney commented 7 years ago

Should be fixed!