ctimmerm/axios-mock-adapter

Typescript compile error with 1.21.3

steve-baldwin opened this issue · 7 comments

Upgrading from 1.21.2 to 1.21.3 causes this:

[~/git/koopa-api] yarn tsc:check
yarn run v1.22.19
$ tsc --noEmit
node_modules/axios-mock-adapter/types/index.d.ts:55:6 - error TS2702: 'AxiosAdapter' only refers to a type, but is being used as a namespace here.

55 ) => AxiosAdapter.RequestHandler;
        ~~~~~~~~~~~~


Found 1 error in node_modules/axios-mock-adapter/types/index.d.ts:55

In case it matters, this is with:

  • node 18.14.2
  • typescript 5.0.2

The following tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true
  },
  "exclude": ["jest.config.js"]
}

It also causes eslint to fail on @typescript-eslint/no-unsafe-member-access and @typescript-eslint/no-unsafe-call checks:

axiosMock.onPost().reply(200, '...');

eslint with plugin:@typescript-eslint/recommended-requiring-type-checking:

  44:2  error  Unsafe member access .reply on an `any` value  @typescript-eslint/no-unsafe-member-access
  44:2  error  Unsafe call of an `any` typed value            @typescript-eslint/no-unsafe-call

I'm seeing this issue as well

It also causes eslint to fail on @typescript-eslint/no-unsafe-member-access and @typescript-eslint/no-unsafe-call checks:

axiosMock.onPost().reply(200, '...');

eslint with plugin:@typescript-eslint/recommended-requiring-type-checking:

  44:2  error  Unsafe member access .reply on an `any` value  @typescript-eslint/no-unsafe-member-access
  44:2  error  Unsafe call of an `any` typed value            @typescript-eslint/no-unsafe-call

This was fixed by #368, but it's not yet released.

This was fixed by #368, but it's not yet released.

Hello Sir
When this will release #368

Released as v1.21.4

Released as v1.21.4

Thank you sir