Treat imported JSON as typed literal
Aperta
feature request
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
When importing a JSON module it seems that flow treats its value as an `any` type. It would be great if flow would instead treat it as a typed literal, just like it would if the given object was inlined. E.g.
```javascript
//obj.json
{
"val" : "sadf"
}
//index.js
import obj from 'obj.json';
function double(x : number) {
return x * 2;
}
// $ExpectError
double(obj.val);
// $ExpectError
obj.nonExisting;
// $ExpectError
const key : $Keys = 'notAKey';
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.