adyen-web icon indicating copy to clipboard operation
adyen-web copied to clipboard

[FEAT] Export types

Open nklaasse opened this issue 4 years ago • 7 comments

It would make sense for Typescript projects also export typings such as CoreOptions.

nklaasse avatar Oct 02 '20 12:10 nklaasse

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.

mrkosima avatar Oct 05 '20 08:10 mrkosima

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.

iLaurens avatar Oct 19 '21 08:10 iLaurens

I'm looking for this as well.

WoodyWoodsta avatar Mar 03 '22 12:03 WoodyWoodsta

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.

Benjamindudok avatar Jun 13 '22 09:06 Benjamindudok

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.

DanielRitvas avatar Feb 11 '23 20:02 DanielRitvas

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

Fifciu avatar Aug 11 '23 11:08 Fifciu