Flow version: 0.93.0
Flow-Typed version: 2.5.1
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
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 {
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 ๐
@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)
Most helpful comment
@lll000111
http$ClientRequest<>would work. Default parameters only work in classes, interfaces and types (doesn't work in functions, methods)