braintree / braintree-web-drop-in

Braintree Drop-in for the web
MIT License
200 stars 126 forks source link

Typescript: Subsequent variable declarations #725

Closed saadrawasia closed 3 years ago

saadrawasia commented 3 years ago

General information

Issue description

I am using react and typescript. Whenever I run npm run start it shows the error that I have to install @types/braintree-web-drop-in. After installing that when I run npm run start it shows the following error:

ERROR in /../frontend/node_modules/@types/braintree-web-drop-in/index.d.ts(259,11): 259:11 Subsequent variable declarations must have the same type. Variable 'braintree' must be of type 'typeof import("/../frontend/node_modules/@types/braintree-web/index")', but here has type '{ dropin: { create(options: Options, callback: (error: object | null, dropin: Dropin | undefined) => void): void; create(options: Options): Promise; }; }'. 257 | 258 | declare global {

259 | const braintree: { | ^ 260 | dropin: { 261 | create(options: Options, callback: (error: object | null, dropin: Dropin | undefined) => void): void; 262 | create(options: Options): Promise;

I am unable to resolve the issue.

crookedneighbor commented 3 years ago

We do not maintain those type definitions.

The next major version of the core SDK and Drop-in will be written in Typescript, so you will no longer need this 3rd party type definition.

In the meantime, you can either supply your own type definitions, or ignore typing concerns for the Braintree SDK.

JustFly1984 commented 2 years ago

@crookedneighbor Do you have estimates on new version release?

crookedneighbor commented 2 years ago

I do not have an estimate yet. It's unlikely to be ready in the near future though. (first will come upgrading the core Braintree SDK that Drop-in uses internally to Typescript, then we can start the work of upgrading Drop-in to Typescript as well)