facebook / facebook/flow

Please consider using a different file extension.

Aperta
#4,233 5 commenti 28 reazioni 0 assegnatari Vedi su GitHub
discussion
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

#### Disclaimer
Recently I have decided to give a typescript a try for a smaller scale project to see how it compares to flow. My hope is to provide some constructive feedback in regards to where typescript falls behind the typescript.

----

In my experience typescript's did a better choice going with `.ts` and `.d.ts` file extensions over overloading `.js` file with added `@flow` pragma. I can see no advantages of using `.js` file extension but several disadvantages:

- **Tooling support**. I run into different issues with different tools (mostly editors) as typically file extension are they way the detect the source language, but that is not the case with flow.
- **package entry point**. This maybe solved differently, but having a different file extension makes it not issue. In ts if you choose to output result along the side with a source dependent code that imports modules will end up importing typed modules instead of compiled versions. In flow you either work your way around it or flow ends up analyzing untyped compiled output of the dependency.
- **misleading**. You'd be surprised how often I have to answer why does these `.js` files look weird, and after explaining a followup question of why flow does not uses a separate file extension.
- **forget pragma** If you forgot pragma or have a typo behavior becomes surprising.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.