adyen-web
adyen-web copied to clipboard
[FEAT] Export types
It would make sense for Typescript projects also export typings such as CoreOptions
.
As a workaround I'm using:
import type { CoreOptions } from '@adyen/adyen-web/dist/types/core/types';
But I'm agree that it would be much helpful to have exported types in root.
I would like to see this as well. In my case I am using the custom card integration (secured fields) and I wanted to make it more robust by using TypeScript. I tried mapping function signatures manually for functions like create
, onChange
, onError
etc but found it difficult to find the correct typings due to arbitrary naming and such. I could also imagine that these internals may change with patch releases while they would end up on the integrating side as breaking changes. If types get exported, it would be great if they are precise instead of using types like any
or object
.
I'm looking for this as well.
As a workaround I'm using:
import type { CoreOptions } from '@adyen/adyen-web/dist/types/core/types';
But I'm agree that it would be much helpful to have exported types in root.
We used this workaround too. Though probably an update somewhere in our build system 'broke' this method because the types aren't in the 'exports' of the package. Which probably has something to do with Typescript not completely adhering to ESM module specifications (yet).
We're now getting the following error in our project with Vue 3 using Vite:
[ERROR] [plugin vite:dep-scan] Missing "./dist/types/core" export in "@adyen/adyen-web" package
Which is pretty much the same as this issue in the vite repository: https://github.com/vitejs/vite/issues/7749.
Up.It would actually be very useful to be able to import types via npm! I'm using the library as an embedded script so there is no way to access types in the code at the moment in any way.
Up. I would love to import types easily. For now, I am using:
import type { CoreOptions } from "@adyen/adyen-web/dist/types/core/types";
import type { DropinElementProps } from "@adyen/adyen-web/dist/types/components/Dropin/types";
But it would be much better to import just from the @adyen/adyen-web
.
I've just prepared a very simple PR addressing this issue: #2294