A
A
Andrey2019-09-13 16:27:37
React
Andrey, 2019-09-13 16:27:37

Flow: Why don't Type Aliases work in a function argument?

Code examples:

type TBlogPostParams = {
    text: string
}
class Api {
    async addBlogPost(params: TBlogPostParams): Promise<any> {
   }
}

I call somewhere in the code without arguments and everything is OK, Flow sees no problems
api.addBlogPost()
. And if like this:
class Api {
    async addBlogPost(params:  {
       text: string
    }): Promise<any> {
   }
}

And then call without arguments (see above), then an error is highlighted that there is no argument. Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i1yas, 2019-09-13
@f-end


I call somewhere in the code without arguments and everything is OK, Flow sees no problems
api.addBlogPost ()
It can't be, it will swear in both cases. Maybe they forgot
somewhere// @flow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question