Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flow 0.75.0 reports 'Deprecated $call syntax' error with Axios #2405

Closed
benjreinhart opened this issue Jun 21, 2018 · 10 comments
Closed

Flow 0.75.0 reports 'Deprecated $call syntax' error with Axios #2405

benjreinhart opened this issue Jun 21, 2018 · 10 comments

Comments

@benjreinhart
Copy link

Hey there! I'm getting the following error regarding the $call (lowercase c) syntax. I'm not familiar with this syntax and there's nothing in the flow docs about this. The only mention of it I could find was an old github issue in the flow repo and it wasn't helpful.

This started happening when I upgraded flow from 0.74.0 to 0.75.0.

  • flow: 0.75.0
  • yarn: 1.7.0
  • typed/npm/axios_v0.18.x.js
> yarn flow
yarn run v1.7.0
$ ./node_modules/.bin/flow status
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ flow-typed/npm/axios_v0.18.x.js:102:5

Deprecated $call syntax. Use callable property syntax instead. (deprecated-call-syntax)

      99│   declare type AxiosPromise<T,R = T> = Promise<AxiosXHR<T,R>>;
     100│   declare class Axios {
     101│     constructor<T,R>(config?: AxiosXHRConfigBase<T,R>): void;
     102│     $call: <T,R>(
     103│       config: AxiosXHRConfig<T,R> | string,
     104│       config?: AxiosXHRConfig<T,R>
     105│     ) => AxiosPromise<T,R>;
@madole
Copy link

madole commented Jun 22, 2018

Getting this with the styled-components flow-typed package.

  declare export default {
    $call: $npm$styledComponents$Call<ComponentListKeys>,
    css: TaggedTemplateLiteral<Array<Interpolation>>,
    ...$npm$styledComponents$StyledComponentsComponentList,
    ...$npm$styledComponents$StyledComponentsNativeComponentList,
  }
[flow] Deprecated $call syntax. Use callable property syntax instead. (`deprecated-call-syntax`)

Can't find any documentation on what the callable property syntax is

@eqyiel
Copy link
Contributor

eqyiel commented Jun 22, 2018

@madole you can read a bit more about it here: https://github.com/facebook/flow/releases/tag/v0.75.0

AFAICT, s/$call/[[call]]/g, but it seems like that doesn't work.

@madole
Copy link

madole commented Jun 22, 2018

I did try that as well without any luck. Ended up hacking the type, not even sure it's doing the same thing now :(

@ryota-murakami
Copy link

ryota-murakami commented Jun 22, 2018

thanks all!

i'm facing this error too and also even for packages other than axios.
so is there a way(i guess .flowconfig setting) to suppress deprecated-call-syntax Error?

it is useful until reflect fix to type definition file.

@dashed
Copy link
Contributor

dashed commented Jun 24, 2018

Looking at the tests: https://github.com/facebook/flow/blob/40a72f81e2f29e5a86a62738be036a852931a456/tests/call_properties/internal_slot.js

$call: () => void would be changed to [[call]](): void.

EDIT: nevermind. see: #2405 (comment)

@alecmev
Copy link

alecmev commented Jun 25, 2018

Hmm, naive $call -> [[call]] worked fine for me, at least on Axios and Express.

@dashed
Copy link
Contributor

dashed commented Jun 25, 2018

@jeremejevs yea I kinda realized this. I had to do something weird like this to make flow happy:

  declare export default {
    css: TaggedTemplateLiteral<Array<Interpolation>>,
    ...$npm$styledComponents$StyledComponentsComponentList,
    ...$npm$styledComponents$StyledComponentsNativeComponentList,
  } & {
    [[call]]: $npm$styledComponents$Call<ComponentListKeys>
  }

@ryota-murakami
Copy link

@dashed thank you so much for your mention!
i was not taking care about flow change log & implementation, but looks interesting.
i'm one of flow fan people, i've just motivated learn & activity about enhance for developer experience😀

@dhui
Copy link
Contributor

dhui commented Sep 5, 2018

Looks like this was fixed by #2456

@AndrewSouthpaw
Copy link
Contributor

Sweet, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants