facebook / facebook/flow

Please consider using a different file extension.

Open
#4,233 5 comments 28 reactions 0 assignees View on GitHub
discussion
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

#### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.