facebook / facebook/flow

Autocomplete results incomplete when including from library.

Aperta
#4,066 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
autocomplete
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I have a project which is built using flow and exports the flowtypes via .js.flow files.
The .js.flow files are generated through the [flow-copy-source](https://github.com/AgentME/flow-copy-source) library.

The library is called redux-mad-authentication and it can be found [here](https://github.com/42BV/redux-mad-authentication).

It contains a method called `configureAuthentication` with the following definition:

```js
export type Config = {
handshakeUrl: string,
authenticationUrl: string,
currentUserUrl: string,
loginRoute: string,
dispatch: (Action) => void,
authenticationStore: () => AuthenticationStore
};

let config: Config | null = null;

export function configureAuthentication(c: Config) {
config = c;
}
```

As you can see the argument to `configureAuthentication` is of type Config. When using the library (through npm) it seems to forget this type.

For example:

![may-31-2017 11-49-07](https://cloud.githubusercontent.com/assets/22608/26626326/31d24c8e-45f7-11e7-8482-0fc1625d446a.gif)

Note how it says that the argument 'c' is of type `any`.

I've also noticed some strange behaviour when exporting a type twice, for example this is part of the index.js file from the library:

```js
export { configureAuthentication } from './config.js';
export type { Config } from './config.js';
```

It simply re-exports a type definition from the 'config.js' file.

Now notice the autocomplete when using it from the 'index':

![may-31-2017 11-53-40](https://cloud.githubusercontent.com/assets/22608/26626541/d1cd7fe2-45f7-11e7-8bf4-beef3baa446f.gif)

Versus using the same function from 'redux-mad-authentication/lib/config':

![may-31-2017 11-54-34](https://cloud.githubusercontent.com/assets/22608/26626581/f409b2ba-45f7-11e7-941c-31828aeffde0.gif)

Note: I'm using vscode in the images with the [Flow Langue Support extension](https://github.com/flowtype/flow-for-vscode) but get the same results in Nuclide.

Is this a bug that I'm experiencing or is this a feature request?

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.