Flow: Flow going into flow-typed directory when options all=true

Created on 14 Feb 2019  ยท  3Comments  ยท  Source: facebook/flow

Flow version: 0.93.0
Flow-Typed version: 2.5.1

Expected behavior

Running ./node_modules/.bin/flow should not go into flow-typed directory
Running with option all=true and ignore should not go into that directory

Actual behavior

Flow returns an error for axios Flow-Typed definition:

Error โ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆโ”ˆ flow-typed/npm/axios_v0.18.x.js:132:15

Cannot use http$ClientRequest [1] without 0-1 type arguments.

     flow-typed/npm/axios_v0.18.x.js
      129โ”‚
      130โ”‚   declare class AxiosError<T,R = T> extends Error {
      131โ”‚     config: AxiosXHRConfig<T,R>;
      132โ”‚     request?: http$ClientRequest | XMLHttpRequest;
      133โ”‚     response?: AxiosXHR<T,R>;
      134โ”‚     code?: string;
      135โ”‚   }

     /private/tmp/flow/flowlib_2ebbbcbe/node.js
 [1] 1297โ”‚ declare class http$ClientRequest<SocketT = net$Socket> extends stream$Writable {

Steps to Reproduce:

Create .flowconfig file

[ignore]
.*/flow-typed/.*
<PROJECT_ROOT>/dist/.*
.*/node_modules/.*

[include]
<PROJECT_ROOT>/src/.*

[options]
all=true

Install axios and flow modules

$ npm install axios
$ npm install -D flow-bin flow-typed
$ ./node_modules/.bin/flow-typed install
$ ./node_modules/.bin/flow

Thank you ๐Ÿ˜„

bug module resolution

Most helpful comment

@lll000111 http$ClientRequest<> would work. Default parameters only work in classes, interfaces and types (doesn't work in functions, methods)

All 3 comments

@daslani it also does it without all=true, just fix flow-typed definitions

@goodmind

https://github.com/facebook/flow/blob/v0.93/lib/node.js#L1297

declare class http$ClientRequest extends stream$Writable {

Interesting, I did not know Flow had a default value option for generic parameters. On the other hand, if it isn't used it seems to be a useless feature? He should not have to provide a parameter if that default value actually worked. Using '*' was deprecated, so if you want to just use the default <net$Socket>, what do you do?

@lll000111 http$ClientRequest<> would work. Default parameters only work in classes, interfaces and types (doesn't work in functions, methods)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bennoleslie picture bennoleslie  ยท  3Comments

Beingbook picture Beingbook  ยท  3Comments

philikon picture philikon  ยท  3Comments

pelotom picture pelotom  ยท  3Comments

damncabbage picture damncabbage  ยท  3Comments