question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flow type definition

See original GitHub issue

We already have a great TypeScript definition. We should have one for Flow too! Both of these type checkers are awesome and we shouldn’t play favorites. This would also be interesting comparison wise.

Anyone familiar with Flow willing to contribute this?

// @thejameskyle

The TypeScript definition is actually partly generated (https://github.com/avajs/ava/pull/884) because it was too tedious to define the chainable test API manually. For example: test.cb.serial.skip(). The properties can be in any order. I wonder if that is needed for Flow too.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

17reactions
jamiebuildscommented, Aug 16, 2016

Okay so I was planning on just playing around with it but you nerd sniped me and I ended up doing the entire type definition.

I was not prepared for how big the generated TypeScript .d.ts file is. I spent a long time trying to deduce what the API limitations were from that API. But then I started exploring the actual implementation in AVA and that was much easier to understand.

One of the things that I thought was unusual with the TypeScript definition you generate is that it reduces the API methods down to act like they can’t chain forever despite option-chain supporting the ability to chain infinitely. I ignored that piece because it seemed unimportant and that it would only serve to greatly complicate the type definition, not to mention now it’s matching what happens at the runtime.

It also adds support for .always since I noticed that was missing from the TypeScript definition.

Anyways here is the current state of the definition, I’m happy to say it’s only like 200 lines compared to the 1,200 line TypeScript definition: https://gist.github.com/thejameskyle/6a0f4d2ef41ed3a7554ce1fa208ae291

I’m sure it has a handful of issues, I haven’t really done that much testing of it, I’ve just been keeping a lot of it in my head.

6reactions
jamiebuildscommented, Aug 16, 2016

Also, people keep taking this as a comparison between Flow and TypeScript. I wasn’t bragging about Flow, I was bragging about my own mad skillz trying to figure out that crazy type definition.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Library Definitions | Flow
A libdef is a special file that informs Flow about the type signature of some specific third-party module or package of modules that...
Read more >
flow-typed/flow-typed: A central repository for Flow ... - GitHub
A repository of high-quality, third-party library type definitions for use with Flow. ci status npm package docs discord package health ...
Read more >
What Is Flow in JavaScript? A Simple Introduction - Testim.io
Flow is a static type checker that allows a developer to check for type errors while developing code. This means a developer receives...
Read more >
Overview of the different types of flows - Microsoft Learn
Flow type, Use case, Automation target ... that leads people through the processes their organization has defined for interactions that need ...
Read more >
Are there any flow types definition for react-native styles?
I'm making a react native component and using Flow to define the property types like this: type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found