Any way to make Flow strongly type an imported JSON file?
Open
feature request
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
When I do `import foo from 'foo.json'` the foo object has `any` type.
From #5150 I realise there is a way to declare the type of a JSON file by writing a libdef for it. But as the JSON file is config local to my project, I’d rather it act as its own definition, and have Flow be aware of its entire structure (treated preferably as a deeply immutable object with literal-typed values). So I can just import JSON into a JS module and have full autocompletion and type checking.
Contributor guide
Assessment
This issue has not been assessed yet.