You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type {Token: string; Refresh: string; } "to type" AxiosRequestHeaders ".
Type "{Token: string; Refresh: string; } "Missing the following properties for type" AxiosHeaders ": set, get, has, delete and 19 others
Type "{params: {LayoutId: (string | number | null) []; check: string; }; } "cannot be assigned to an argument of type" AxiosRequestConfig ".
Type {params: {" LayoutId: (string | number | null) []; check: string; }; The attribute "headers" is missing from "}", but is required for type "AxiosRequestConfig"
To Reproduce
No response
Code snippet
No response
Expected behavior
No response
Axios Version
No response
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
Reacted by Otto Ottinger, Rainer Angermeier // RAN Soft, Stephen Zhang, Joren 's Jongers, Johannes Loher, Eros Valzasina, Angger Rafi Akbar, Peter Smolinský, Peter, Tony Barnes and 21 more
@laterdayi yep, because the headers property is mandatory in the AxiosRequestConfig type. Another option would be to create an AxiosHeader instance instead switching the type.
But I'm not sure if the behaviour changes again in an upcoming release :person_shrugging:
Another problem here is that you cannot create, with valid typescript, a instance of AxiosRequestHeaders.
// Type '{}' is missing the following properties from type// 'AxiosHeaders': set, get, has, delete, and 19 more.constheaders: AxiosRequestHeaders={};// Type 'AxiosHeaders' is not assignable to type // 'Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>'constheaders: AxiosRequestHeaders=newAxiosHeaders();
Reacted by Nguyen Thai Hung and Carlos151294
Reacted by Daniel Hillmann, Doug Shontz, Jr., Arthur Fiorette, Adam Mołczan, Teng Yang, Dmytro Symonov, SNSN100, Luke, Joel, Abhishek Chaudhuri and 1 more
The PR #5420 ontroduced a breaking API change in a patch versin release 1.2.3. This also broke our pipeline. As mentioned replacing AxiosRequestConfig with RawAxiosRequestConfig solves the issue. However, it would be great if you could be more careful in the future. If you look at the changes adding a mandatory field headers is obviously not type compatible in structural typing. So you should use assertions/checks in version 1.X.Y and make it mandatory in version 2.X.Y.
Reacted by Florian Wilhelm, Hector Ayala and Peter Shih
@jameyg42 Definitely should, however, it is not always possible to make a fix for one thing without any impact on another. It seems that no matter what solution we choose here, the consequences cannot be completely avoided. The only question is where they will appear and how significantly they will affect.
leave the update as is:
External (user) config - RawAxiosConfig
Internal - AxiosConfig
partial rollback with an alias (probably until the next major release):
External (user) config - AxiosConfig = RawAxiosConfig (alias)
Internal - InternalAxiosConfig
leave the update as is:
External (user) config - RawAxiosConfig
Internal - AxiosConfig
partial rollback with an alias (probably until the next major release):
External (user) config - AxiosConfig = RawAxiosConfig (alias)
Internal - InternalAxiosConfig
@arthurfiorette If we are still going to rename the interface in the next major version, then the 2nd option could be preferable since users who have already changed the interface's name will not be forced to rename it back. I don't think they'll be thrilled about it :) Of course, it depends on whether users use the updated AxiosConfig interface somewhere as an internal config or not. We need to think carefully about this step.
I believe option 2 is the best approach at this point. We'll keep the fix introduced by #5420 to solve issue #5415 while leaving the interface name as before. Still a (relatively) small breaking change because of the required prop, but users won't have to change AxiosConfig to RawAxiosConfig everywhere. It seems like a good compromise between all circumstances to me 🙂
Another problem here is that you cannot create, with valid typescript, a instance of AxiosRequestHeaders.
// Type '{}' is missing the following properties from type// 'AxiosHeaders': set, get, has, delete, and 19 more.constheaders: AxiosRequestHeaders={};// Type 'AxiosHeaders' is not assignable to type // 'Partial<RawAxiosHeaders & MethodsHeaders & CommonHeaders>'constheaders: AxiosRequestHeaders=newAxiosHeaders();
Activity
laterdayi commentedon Jan 18, 2023
in 1.2.2 ,it work
laterdayi commentedon Jan 18, 2023
herader is not required to use it
alecgibson commentedon Jan 18, 2023
I think this was a type-breaking change introduced in #5420
You now need to replace usage of
AxiosRequestConfigwithRawAxiosRequestConfig.tada5hi commentedon Jan 18, 2023
TS2741: Property 'headers' is missing in type '{ proxy: false; }' but required in type 'ClientRequestConfig<any>'.tada5hi commentedon Jan 18, 2023
follow up issue of #5416
laterdayi commentedon Jan 18, 2023
such as
This means that all types that use AxiosRequestConfig need to be replaced All with RawAxiosRequestConfig ?
@tada5hi @alecgibson
tada5hi commentedon Jan 18, 2023
@laterdayi yep, because the headers property is mandatory in the
AxiosRequestConfigtype. Another option would be to create an AxiosHeader instance instead switching the type.But I'm not sure if the behaviour changes again in an upcoming release :person_shrugging:
laterdayi commentedon Jan 18, 2023
@tada5hi The current solution is to change everything you use with AxiosRequestConfig to RawAxiosRequestConfig, right?
tada5hi commentedon Jan 18, 2023
@laterdayi Taking into account the current version, yes.
This should also avoid the following generic bug: #5478
laterdayi commentedon Jan 18, 2023
@tada5hi Expect the next release to fix this
arthurfiorette commentedon Jan 18, 2023
Another problem here is that you cannot create, with valid typescript, a instance of
AxiosRequestHeaders.bombillazo commentedon Jan 19, 2023
Im getting this error when setting headers inline:

VGalata commentedon Jan 19, 2023
AxiosResponseis also affected by the introduced breaking change as it hasconfig: AxiosRequestConfig<D>(see here in code).FrankEssenberger commentedon Jan 19, 2023
The PR #5420 ontroduced a breaking API change in a patch versin release 1.2.3. This also broke our pipeline. As mentioned replacing
AxiosRequestConfigwithRawAxiosRequestConfigsolves the issue. However, it would be great if you could be more careful in the future. If you look at the changes adding a mandatory fieldheadersis obviously not type compatible in structural typing. So you should use assertions/checks in version 1.X.Y and make it mandatory in version 2.X.Y.bombillazo commentedon Jan 19, 2023
Can confirm this works for us! 🙌
6 remaining items
DigitalBrainJS commentedon Jan 19, 2023
@jameyg42 Definitely should, however, it is not always possible to make a fix for one thing without any impact on another. It seems that no matter what solution we choose here, the consequences cannot be completely avoided. The only question is where they will appear and how significantly they will affect.
bombillazo commentedon Jan 19, 2023
What about the prefix
Custom?To me,
Rawsounds like some type that is used internally by Axios and has not been sanitized/transformed to make it usable by others.feat! adapt to axios 1.2.3
DigitalBrainJS commentedon Jan 20, 2023
So it seems there are three options:
External (user) config -
RawAxiosConfigInternal -
AxiosConfigExternal (user) config -
AxiosConfig=RawAxiosConfig(alias)Internal -
InternalAxiosConfigExternal (user) config -
AxiosConfigInternal -
InternalAxiosConfigAny suggestions are welcome.
arthurfiorette commentedon Jan 20, 2023
Can we use 3 until next big release?
rcoundon commentedon Jan 20, 2023
I don't think 1 is quite right - see #5476 (comment)
DigitalBrainJS commentedon Jan 20, 2023
@rcoundon that was another issue due to a missing generic parameter in the interface declaration. This has been fixed in the codebase with #5478.
DigitalBrainJS commentedon Jan 20, 2023
@arthurfiorette If we are still going to rename the interface in the next major version, then the 2nd option could be preferable since users who have already changed the interface's name will not be forced to rename it back. I don't think they'll be thrilled about it :) Of course, it depends on whether users use the updated AxiosConfig interface somewhere as an internal config or not. We need to think carefully about this step.
rcoundon commentedon Jan 20, 2023
Ok - thanks for clarifying
JoseLion commentedon Jan 21, 2023
I believe option 2 is the best approach at this point. We'll keep the fix introduced by #5420 to solve issue #5415 while leaving the interface name as before. Still a (relatively) small breaking change because of the required prop, but users won't have to change
AxiosConfigtoRawAxiosConfigeverywhere. It seems like a good compromise between all circumstances to me 🙂JoseLion commentedon Jan 21, 2023
This is another big piece to consider, though 🤔
chore(nodejs): Bump dependencies.
chore(nodejs): Bump dependencies.
nfantone commentedon Jan 31, 2023
1.2.6is also affected. Last healthy version seems to be1.2.2as of now.