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

Fixed potential typescript error in examples/axios-typescript #265

Merged
merged 1 commit into from
Feb 24, 2020
Merged

Fixed potential typescript error in examples/axios-typescript #265

merged 1 commit into from
Feb 24, 2020

Conversation

Svish
Copy link
Contributor

@Svish Svish commented Feb 15, 2020

Fixes #238 (hopefully)

Copy link
Member

@shuding shuding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@shuding shuding merged commit 63fdb92 into vercel:master Feb 24, 2020
@FridgeWalaby
Copy link

@Svish @quietshu
My vscode still complains about the next line after () => axios(request!),

{
      ...config,
      initialData: initialData && {
        status: 200,
        statusText: 'InitialData',
        config: request,
        headers: {},
        data: initialData
      }
    }

These lines get the following error:

Argument of type '{ initialData: { status: number; statusText: string; config: GetRequest; headers: {}; data: Data; } | undefined; errorRetryInterval?: number | undefined; loadingTimeout?: number | undefined; ... 14 more ...; compare?: ((a: AxiosResponse<...> | undefined, b: AxiosResponse<...> | undefined) => boolean) | undefined; }' is not assignable to parameter of type 'ConfigInterface<AxiosResponse<Data>, AxiosError<Error>, fetcherFn<AxiosResponse<Data>>>'.
  Types of property 'initialData' are incompatible.
    Type '{ status: number; statusText: string; config: GetRequest; headers: {}; data: Data; } | undefined' is not assignable to type 'AxiosResponse<Data> | undefined'.
      Type '{ status: number; statusText: string; config: GetRequest; headers: {}; data: Data; }' is not assignable to type 'AxiosResponse<Data>'.
        Types of property 'config' are incompatible.
          Type 'GetRequest' is not assignable to type 'AxiosRequestConfig'.
            Type 'null' is not assignable to type 'AxiosRequestConfig'
`
``

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

Successfully merging this pull request may close these issues.

axios-typescript exemple doen't work
3 participants