facebook / facebook/flow

Checking initialization not working with module pattern literals

Aperta
#3,864 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hi everyone,

I have the following simple code. Unfortunately flow doesn't recognize the initialization of the variable (I use nuclide and atom) inside the testMethod. So the last line complains "string - This type is incompatible with uninitialized variable" which is not correct because it is getting initialized in the testMethod before. This is a bug, isn't it?

Best,
Chris

```js
var Module = (function () {
var anotherMember : string;

var testMethod = function () {
anotherMember = "initialize123";

};

return {
testMethod: testMethod,
anotherMember: anotherMember

};

})();

Module.testMethod();
Module.anotherMember = "changeValue";
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.