Add Flow Typings to the Package

Stemming from #1742, I’d love to get really great flow definitions. There are some basic ones in However, there are missing ones (see flow-typed/flow-typed#2285).

I would prefer that they match the source material as much as possible so I followed #1742 (comment) as best I could to convert typescript to flow using flowgen. All I got was a stream of Missing node parse ExportDeclaration errors. 😭 Here’s the code I used:

Open me for sample code
// Run as 
// $ node genDefs.js

 * Converts typescript definitions for RxJS to Flow

const flowgen = require('flowgen')
const { compiler } = flowgen.default

 $ ls node_modules/rxjs/*.ts
   node_modules/rxjs/AsyncSubject.d.ts        node_modules/rxjs/Rx.d.ts
   node_modules/rxjs/BehaviorSubject.d.ts     node_modules/rxjs/Scheduler.d.ts
   node_modules/rxjs/InnerSubscriber.d.ts     node_modules/rxjs/Subject.d.ts
   node_modules/rxjs/Notification.d.ts        node_modules/rxjs/SubjectSubscription.d.ts
   node_modules/rxjs/Observable.d.ts          node_modules/rxjs/Subscriber.d.ts
   node_modules/rxjs/Observer.d.ts            node_modules/rxjs/Subscription.d.ts
   node_modules/rxjs/Operator.d.ts            node_modules/rxjs/index.d.ts
   node_modules/rxjs/OuterSubscriber.d.ts     node_modules/rxjs/interfaces.d.ts

const filename = "node_modules/rxjs/index.d.ts"

const flowdef = compiler.compileDefinitionFile(filename);


Would there be a way for us to maintain the flow definitions inside of rxjs and potentially generate them based on the typescript definitions?

1 thought on “Add Flow Typings to the Package

Comments are closed.