import type * as types from './types'
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
This is half bug report, half feature request. Starting with the bug report:
## Bug
`flow` does an infinite restart cycle when encountering `import type *`. I noticed this in nuclide (no errors) when the flow integration stopped working and my laptop fan turned on. On the command line (see output below), the error was in the log file. After more testing, `flow check` did print a decent error message.
I'd expect an error in the terminal and either for the process to exit, or for flow to patiently wait for a file change. Depending on the fix, there should be some way for editor integration to handle this error.
### Repro Case
```sh
npm install flow-bin
./node_modules/.bin/flow init
printf '// @flow \nimport type * as types from "./types"' > example.js
./node_modules/.bin/flow
```
Output; repeats forever.
```
Launching Flow server for /private/tmp/temp-flow-17630
Spawned flow server (pid=87127)
Logs will go to /private/tmp/flow/zSprivatezStmpzStemp-flow-17630.log
Launching Flow server for /private/tmp/temp-flow-17630
Spawned flow server (pid=87146)
Logs will go to /private/tmp/flow/zSprivatezStmpzStemp-flow-17630.log
Launching Flow server for /private/tmp/temp-flow-17630
Spawned flow server (pid=87165)
Logs will go to /private/tmp/flow/zSprivatezStmpzStemp-flow-17630.log
Launching Flow server for /private/tmp/temp-flow-17630
Spawned flow server (pid=87184)
Logs will go to /private/tmp/flow/zSprivatezStmpzStemp-flow-17630.log
Launching Flow server for /private/tmp/temp-flow-17630
```
Log file:
```
[2017-10-13 00:58:24] Initializing Server (This might take some time)
[2017-10-13 00:58:24] executable=/private/tmp/temp-flow-17630/node_modules/flow-bin/flow-osx-v0.56.0/flow
[2017-10-13 00:58:24] version=0.56.0
[2017-10-13 00:58:24] Parsing
Exception: Failure("unsupported syntax: import type *")
Potential backtrace:
Worker exited (code: 2)
Subprocess(87762): fail 2Worker.Worker_exited_abnormally(2)
```
> If this is a bug, please try reproducing using https://flow.org/try/.
It doesn't reproduce there.
## Feature
It'd be great if `import type * types from './types'` worked. It seems consistent with the other apis, and babel already parses and strips it.
This also addresses https://github.com/facebook/flow/issues/4673
---
Thanks for the great tool!
Contributor guide
Assessment
This issue has not been assessed yet.