after upgrade to ^3.0.0-rc.32", i got compilation error using CallAnApi.using(axiosInstance) (with axios 1.1.3)
See original GitHub issuetest:consent:stage] TSError: ⨯ Unable to compile TypeScript: [test:consent:stage] src/Actors.ts(18,29): error TS2345: Argument of type ‘import(“/Users/xxxxx/dev/sh-common-services-serenityjs/node_modules/axios/index”).AxiosInstance’ is not assignable to parameter of type ‘import(“/Users/xxxxxxx/dev/sh-common-services-serenityjs/node_modules/@serenity-js/rest/node_modules/axios/index”).AxiosInstance’. [test:consent:stage] The types of ‘defaults.headers.common’ are incompatible between these types. [test:consent:stage] Type ‘Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>’ is not assignable to type ‘AxiosRequestHeaders’. [test:consent:stage] ‘string’ index signatures are incompatible. [test:consent:stage] Type ‘AxiosHeaderValue’ is not assignable to type ‘string | number | boolean’. [test:consent:stage] Type ‘AxiosHeaders’ is not assignable to type ‘string | number | boolean’. [tes
Actors.ts:
baseURL: process.env.WEATHER_SERVICE_BASE_URL,
timeout: 5000,
headers: { Accept: 'application/json' },
});
export class Actors implements Cast {
constructor(private readonly baseApiUrl: string) {
ensure('apiUrl', baseApiUrl, isNotBlank());
}
prepare(actor: Actor): Actor {
return actor.whoCan(
CallAnApi.using(axiosInstance),
TakeNotes.usingAnEmptyNotepad(),
);
}
}
package.json
"@cucumber/cucumber": "^8.3.1",
"@serenity-js/assertions": "^3.0.0-rc.32",
"@serenity-js/console-reporter": "^3.0.0-rc.32",
"@serenity-js/core": "^3.0.0-rc.32",
"@serenity-js/cucumber": "^3.0.0-rc.32",
"@serenity-js/rest": "^3.0.0-rc.32",
"@serenity-js/serenity-bdd": "^3.0.0-rc.32",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"axios": "^1.1.3",
"axios-debug-log": "^0.8.4",
"axios-mock-adapter": "^1.20.0",
Issue Analytics
- State:
- Created a year ago
- Comments:12

Top Related StackOverflow Question
Hi @LayMui , looks like you use axios version 1.1.3, could you try to downgrade to the version serenity-js/rest is using (^0.27.2).
https://github.com/serenity-js/serenity-js/blob/3480ba44d83ff663a6a7c3e51ab1f977776cc9d0/packages/rest/package.json#L49
@jan-molak , we already had this issue, see #1223 , looks as it‘s back in axios 1.x
yes @viper3400 , i agree this is a separate issue. so I will close this as resolved after change the axios version