flow-to-typescript icon indicating copy to clipboard operation
flow-to-typescript copied to clipboard

Question: Convert to Typescript definition files possible?

Open panmona opened this issue 7 years ago • 4 comments

Can this project also generate typescript definition files (.d.ts) from flow files?

panmona avatar Apr 26 '18 16:04 panmona

It would be pretty straightforward to write a generator for that (see generator.ts in this repo). What’s the use case?

bcherny avatar Apr 26 '18 16:04 bcherny

There's a react component library that uses flow. Typescript users would like to also have typings so an automatic generation would be great. (not two definition files need to be maintained)

For more, see here: https://github.com/jamesmfriedman/rmwc/issues/40

panmona avatar Apr 26 '18 16:04 panmona

GitHub can't find that generator.ts file. Can you show where that is? Or provide an example for that straightforward generator?

panmona avatar May 03 '18 15:05 panmona

Whoops, when I wrote that comment I thought I was in a different repo 😅.

Two things:

  1. This package is not yet ready to use (see https://github.com/bcherny/flow-to-typescript/issues/1)
  2. When it is (or if you want to contribute!), I’d run the generated .ts file through TSC with the -d flag to generate .d.ts

bcherny avatar May 03 '18 15:05 bcherny