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

include supported axios minor version near the top of documentation #331

Closed
xenoterracide opened this issue Mar 4, 2022 · 1 comment · Fixed by #356
Closed

include supported axios minor version near the top of documentation #331

xenoterracide opened this issue Mar 4, 2022 · 1 comment · Fixed by #356

Comments

@xenoterracide
Copy link

xenoterracide commented Mar 4, 2022

context below, my version of the mock did not line up with the axios version we're using, could you include the supported version near the top of your documentation please


getting this error

TS2345: Argument of type 'AxiosStatic' is not assignable to parameter of type 'AxiosInstance'.   Types of property 'defaults' are incompatible.     Type 'AxiosRequestConfig' is not assignable to type 'AxiosDefaults<any>'.       Property 'headers' is optional in type 'AxiosRequestConfig' but required in type 'AxiosDefaults<any>'.

here's my code

import axios from 'axios'
import MockAdapter from 'axios-mock-adapter'

describe('sociable Controller test', () => {
  const mock = new MockAdapter(axios)
  it('suck', () => {
    mock.adapter()
  })
})
❯ node --version && npm --version && npm ls typescript axios
v16.14.0
8.5.1
@cof/e1-root@ ...
└─┬ back-end@0.0.0 -> ./back-end
  ├─┬ @chassisjs/devexchange-caller@2.4.0
  │ └── axios@0.21.4 deduped
  ├─┬ @cof/e1-workflow-module@0.0.0 -> ./packages/workflow-module
  │ ├─┬ @cof/e1-models@0.0.0 -> ./packages/models
  │ │ ├─┬ ts-node@8.10.2
  │ │ │ └── typescript@4.3.5 deduped
  │ │ └── typescript@4.3.5 deduped
  │ ├─┬ ts-node@8.10.2
  │ │ └── typescript@4.3.5 deduped
  │ └── typescript@4.3.5 deduped
  ├─┬ @typescript-eslint/eslint-plugin@5.13.0
  │ └─┬ tsutils@3.21.0
  │   └── typescript@4.3.5 deduped
  ├─┬ axios-mock-adapter@1.20.0
  │ └── axios@0.24.0
  ├── axios@0.21.4
  ├─┬ ts-node@8.10.2
  │ └── typescript@4.3.5 deduped
  └── typescript@4.3.5
@xenoterracide xenoterracide changed the title typescript signature doesn't match with axios include supported axios minor version near the top of documentation Mar 4, 2022
@fritzfelix
Copy link

Also getting the same error.

The readme here claims compatibility since axios v0.17, but already then axios exported the type AxiosStatic (https://github.com/axios/axios/blob/v0.17.0/index.d.ts#L124) but this library here requires AxiosInstance (https://github.com/ctimmerm/axios-mock-adapter/blob/master/types/index.d.ts#L56).

@ctimmerm Mind fixing the type?

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 a pull request may close this issue.

2 participants