Relay: TypeScript definitions are stale

Created on 13 Jun 2019  路  11Comments  路  Source: facebook/relay

  • The TypeScript definitions for Relay are now quite stale.
  • Related: #2073 was back in 2017, so I'm not sure how invested Facebook is in 2019 to continue Flow support going forward.
  • The golden path would be to generate type definitions with the TypeScript compiler.
  • I don't know of any graceful project setup that would allow Flow and TypeScript to co-exist. As such, would the FB team be at all open to a community rewrite into TS? (a shot in the dark)

Most helpful comment

The best solution would really be to have the source code written in TS, but I'm guessing that might be too much to ask.

While projects like Jest have made the move, I suspect that Relay is going to be a harder sell to FB.

A few quick notes on this:

  • For the most part we don鈥檛 have mandates about what technologies can and can鈥檛 be used, so our team does have the flexibility to choose to use/not use Flow or to use something else. That choice boils down to whether we (Relay core team) want to use another language, and think that changing languages is a worthwhile project relative to other things we could spend our time on. We鈥檙e fortunate to have a supportive manager and if there was a reasonable case to be made to change I鈥檓 confident she鈥檇 support us.
  • TypeScript is by all accounts great. If it鈥檚 the right fit for your team by all means use it. We鈥檙e happy to support folks who use Relay from TypeScript, though we depend more on OSS contributions here.
  • As far as switching languages for Relay core: I can鈥檛 reasonably justify (even to myself) an effort to change language unless the alternative choice would enable us to build features or achieve performance that we couldn鈥檛 otherwise. The obvious elephant in the room is WASM. Using a lower-level language and compiling to WASM could potentially allow us to achieve things that we can鈥檛 in JS (and that matter for Relay use-cases).

So: we鈥檙e probably not changing languages, if we do it probably won鈥檛 be a different gradually-typed JavaScript (or really any language w GC).

All 11 comments

I manually converted the flow type definitions to TypeScript for 3.0, which mostly hold up for 4.0

I'll see about getting that into DefinitelyTyped next week, but I'm not fond of the strategy I took, as there are imperfections especially around the different ways that ?, null, undefined, and void are handled within Flow as opposed to TypeScript.

@sibelius yep, @alloy is great. My plan is to update his existing types which are currently out of date.

And yes, the relay-compiler-language-typescript plugin is fantastic.

can we close this?

As soon as I update those definitions, yes.

This will continue to be a pain point as Relay code is updated and the TS definitions are always chasing its tail (never in sync). The best solution would really be to have the source code written in TS, but I'm guessing that might be too much to ask.

it won't happen soon I guess

While projects like Jest have made the move, I suspect that Relay is going to be a harder sell to FB. However, if by any chance the team _is_ interested but short on manpower, then I would gladly offer some of my time to help out.

The best solution would really be to have the source code written in TS, but I'm guessing that might be too much to ask.

While projects like Jest have made the move, I suspect that Relay is going to be a harder sell to FB.

A few quick notes on this:

  • For the most part we don鈥檛 have mandates about what technologies can and can鈥檛 be used, so our team does have the flexibility to choose to use/not use Flow or to use something else. That choice boils down to whether we (Relay core team) want to use another language, and think that changing languages is a worthwhile project relative to other things we could spend our time on. We鈥檙e fortunate to have a supportive manager and if there was a reasonable case to be made to change I鈥檓 confident she鈥檇 support us.
  • TypeScript is by all accounts great. If it鈥檚 the right fit for your team by all means use it. We鈥檙e happy to support folks who use Relay from TypeScript, though we depend more on OSS contributions here.
  • As far as switching languages for Relay core: I can鈥檛 reasonably justify (even to myself) an effort to change language unless the alternative choice would enable us to build features or achieve performance that we couldn鈥檛 otherwise. The obvious elephant in the room is WASM. Using a lower-level language and compiling to WASM could potentially allow us to achieve things that we can鈥檛 in JS (and that matter for Relay use-cases).

So: we鈥檙e probably not changing languages, if we do it probably won鈥檛 be a different gradually-typed JavaScript (or really any language w GC).

Alright, @ckknight鈥檚 type updates for Relay v4 are merged and an automated release should go out soon, so combined with @josephsavona鈥檚 comment I鈥檓 considering this issue resolved.

Was this page helpful?
0 / 5 - 0 ratings