-
Notifications
You must be signed in to change notification settings - Fork 60
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
[BUG] ICheckout types are not exported #450
Comments
Hi @splacentino You don't import type definition files. All types are already compiled and available within the library (see here), which means you don't need to import the types to use them if you are using the library. I just tested your code, and this works: import { Client, CheckoutAPI } from '@adyen/api-library'
const client = new Client({ apiKey: '1234', environment: 'TEST' })
const checkout = new CheckoutAPI(client)
function getPaymentMethods(): Promise<ICheckout.PaymentMethodsResponse> {
return checkout.paymentMethods({ merchantAccount: 'testMerchantAccount' })
} Also, in your case, the return type is inherited, based on the type definitions of the |
Since this is not a bug, I'll close the issue. But feel free to leave any comments. |
Hi @KadoBOT I made a typo in the example, indeed. Self types import does not look good enough. Could you try with two separate projects Transpilation of project |
How the project is currently set up, it expects you to have the library installed. So it indeed it might fail for cases like yours. If you need to use the types on a different project, you would need the types to be independent, in other words, to be a package (i.e @types/@adyen/api-library). If you feel like, you can open a feature request for that, but that would depend on more requests as is not a priority for us right now. Or, you can add the types to the Lemme know if that helps. |
@KadoBOT Thank you for your advices. Regarding your previous message I was able to apply workaround:
|
@splacentino that's great! Thanks for the update. |
When working with Typescript, I'd like to use pre-built types from
ICheckout
(and other) namespace (AccountInfo
, ...).Because they have no
export
prefix,tsc
compiler does not recognize and process them.To Reproduce
Where you CANNOT import the specific interface as
nor
tsc --build
(this code is part of a composite project).Expected behavior
Successful build.
Actual behaviour
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: