-
Notifications
You must be signed in to change notification settings - Fork 172
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
Inferred types cannot be named without a reference to 'plaid/node_modules/axios' #508
Comments
@m-p-d I'm not an expert on this, but some googling suggests that this might happening if your project uses a different version of axios than is used by plaid-node: microsoft/TypeScript#29808, especially if you are using TypeScript on Windows. Can you try matching the version of axios you're using to the one used by the latest plaid-node and seeing if that fixes it? There are also a couple of other suggestions in the linked GitHub issue that resolved this for other folks that might be worth trying. |
closing this as I haven't heard anything back -- please feel free to reply if you still need help after trying the above suggestions |
Did you ever resolve this issue? I am currently getting this error and I am using the latest version of axios (1.1.3) and it seems that plaid is using 0.21.4, which is over a year old. Is there a solution for this rather than downgrading axios? I couldn't get any of the proposed solutions to work in the linked issue. I am using the newest axios version in order to utilize the current error handling and classes that they have implemented. Hoping I don't have to downgrade it. |
@Ugikie can you try sending the axios you'd like to use as an argument to the plaid api constructor and let us know if that works for you?
Based on the code at https://github.com/plaid/plaid-node/blob/master/dist/base.js we think that should work. |
@phoenixy1 Thanks so much for the response! That actually seems like exactly what I need, but unfortunately that doesn't seem to do the trick. Here is the test code for that solution:
If I try to create some dummy axiosInstance like this:
and assign it via
Not sure if I am still doing something wrong, but I feel like we are close! |
:-( Dang. This is well beyond my node client library knowledge at this point -- I've assigned it to @otherchen to take a look. |
@Ugikie ok, @otherchen gave me the following advice, does this help? Link to the type: |
@Ugikie did you get a chance to try out the suggested solution above? |
Hey @phoenixy1 I'm so sorry I must have missed the notifications for this issue and forgot to check back on it... unfortunately, no, I was unable to solve the issue with the provided solution. I actually tried doing that initially and received the error I linked above. Just tried again today and still getting the same thing. When doing this:
I am still getting this error: Axios version 1.2.3 |
I think I finally found a solution to this. I am now able to install a newer version of axios in the same project that I am using The issue was because I had functions that were basically proxies to the plaid client, and I was not specifying the return type of those functions, and so what would happen with the latest version of axios is that TS would try to infer the type by using So to fix this, what I did was two things:
// import { AxiosResponse } from 'axios' // Don't use this
import { AxiosResponse } from 'plaid/node_modules/axios' // Use this instead
// And then you can do:
export async function plaidProxyFunc(): Promise<AxiosResponse<...>> {
return plaidClient.someFunc(...) // This also has the return type of Promise<AxiosResponse<...>>
} |
We have updated axios to latest in our most recent release which should resolve this without needing to import that specific version. Sounds like you had a version mismatch elsewhere before. |
Getting many "The inferred type of [x] cannot be named without a reference to 'plaid/node_modules/axios'. This is likely not portable. A type annotation is necessary." errors when building node project after upgrading to version 9.12.0. Downgrading to version 9.10.1 does not give these errors.
Using tsconfig.json options:
The text was updated successfully, but these errors were encountered: