-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
after upgrade to ^3.0.0-rc.32", i got compilation error using CallAnApi.using(axiosInstance) (with axios 1.1.3) #1342
Comments
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). serenity-js/packages/rest/package.json Line 49 in 3480ba4
@jan-molak , we already had this issue, see #1223 , looks as it‘s back in axios 1.x |
yes. I fixed the axios version to 0.27.2 I got the following error
here is the code snippet:
BundleData.ts
|
Well, looks like at least the axios error has gone, right? 😕 Now you've got a new error: Is this error related to the upgrade to the latest Serenity/JS version? Has this code worked with version 3.0.0-rc.19 which you've used before? I assume the snippet you've pasted is line 154 from Something like Ensure.that(
LastResponse.body<Bundle<BundleData>>().data.confirmationDialog.description, matches(/\w+/)
) should do the trick. See this example:
In case this does not help: You expect a response of type |
Bundle.ts
|
yes the axios issue is resolved. |
Did you try to remove the I wonder if you would do a downgrade to 3.0.0-rc.19 , if your test is working again? |
Okay, think I found something. You try to access the property called
Have to have a deeper look. |
I see. I found that is another outer field called description interface BundleData { export default BundleData; anyway, I get rid of the compilation error by not checking that field that I commented out. i guess i can leave the .answeredBy(actor) there, right? it does not make any difference without it
| TypeError: rest_1.LastResponse.body(...).data.forecast[0].description.answeredBy is not a function
|
Can you post the code snippet that produces this error and the interface containing the Here are some possible reasons for this error. (For the problem with access the .description I created a separate issue: #1344) |
@LayMui : I copied and pasted your answer in issue #1344 to this issue #1342 as it was requested here. The other issue is a very special situation that I was able to reproduce and like to follow up with Jan Molak separately. I'll delete the comments in the other issue. I'll follow up your ongoing issues here: Copy from other issue interface Forecast<T> {
status: string,
errors: {
msg: string[],
errorCode: number
},
data: {
geocode: string
days: number,
language: string,
units: string,
response: string,
forecast: T
}
}
export default Forecast;
interface HourlyForecast {
cloudCover: number,
temperature: number,
qpf: number,
relativeHumidity: number,
iconCode: number,
windDirection: number,
windSpeed: number,
qualifierSet: string,
description: string,
validTimeUtc: number,
validTimeLocal: Date,
expirationTimeUtc: number,
precipType: string,
precipChance: number
}
export default HourlyForecast;
Ensure.that(
LastResponse.body<Forecast<HourlyForecast>>().data.forecast[0].description.answeredBy(actor), matches(/(.*)/)
), |
Okay, I drilled it down a bit, and you're right, it's the same issue, just a bit covered. I was confused as you access But if I we'd access it like this: Ensure.that(
LastResponse.body<Forecast<HourlyForecast>>().data.forecast.location.answeredBy(actor), matches(/(.*)/)
), than we're back at the initial error message: I can confirm as well, that is was running in 3.0.0-rc.19. This regression was introduced most likely with this change So summing up a bit:
Do you agree
|
yes @viper3400 , i agree this is a separate issue. so I will close this as resolved after change the axios version |
test: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:
package.json
The text was updated successfully, but these errors were encountered: