facebook / facebook/flow

Don't warn about untyped-type-import when importing from .js.flow file

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

Description

I ran into this when using MobX state management library. Currently has this flow type definition file:
https://github.com/mobxjs/mobx/blob/062d50eafc8f6b374d3cfec57233c95cc73a0337/flow-typed/mobx.js

which cannot be used to import types from, because it shows a warning:
```
Warning: src/components/event/SplitDateTimeInput.js:7
7: import type { IReactionDisposer } from 'mobx/lib/mobx.js.flow'
^^^^^^^^^^^^^^^^^ untyped-type-import: Importing a type from an untyped module makes it `any` and is not safe! Did you mean to add `// @flow` to the top of `mobx/lib/mobx.js.flow`
```
I opened a PR to add the pargma(https://github.com/mobxjs/mobx/pull/1233), but wouldn't it make sense to not require `@flow` pragma when importing from a file with the `.js.flow` extension?

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.