braintree / braintree-web-drop-in

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

TypeScript type definition #157

Closed buu700 closed 7 years ago

buu700 commented 7 years ago

A type definition for this to go along with @types/braintree would be really helpful (or have @types/braintree extended to cover braintree.dropin). Glad to see that this is finally supported with the v3 SDK!

lilaconlee commented 7 years ago

This isn't something we have planned at the moment, but we'll update this issue if that changes!

buu700 commented 7 years ago

Got it, makes sense since the main Braintree module doesn't have a first-party type definition (unless @types/braintree-web is maintained by Braintree).

Went ahead and submitted a separate ticket to DefinitelyTyped: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/16474

saoudrizwan commented 5 years ago

I just published type definitions https://www.npmjs.com/package/@types/braintree-web-drop-in

grippstick commented 3 years ago

I am trying to use @types/braintree-web-drop-in, but I am finding an error. Specifically it seems that the drop in is conflicting with braintree-web.

It says "Subsequent variable declarations must have the same type. Variable 'braintree' must be of type 'typeof import("../node_modules/@types/braintree-web/index")', but here has type '{ dropin:{create(options:Options, callback:{error:object,dropin:Dropin) => void):void; create(options:Options):Promise;};}'."

The project is an empty project where I ran the npm install and thats it. The error is coming directly from the definition file, so i think it has to be in there somewhere.

I am going to work around it by moving removing references to outside of the drop-in and replacing them with any, which sort of defeats the purpose.

I am just checking in to make sure I wasn't missing something, because I really want to use this definition.

crookedneighbor commented 3 years ago

@grippstick we don't maintain the type definitions for the core sdk or drop-in.

The next major version of each is being written in Typescript, so these type definition files will be unnecessary then.

grippstick commented 3 years ago

@crookedneighbor Thanks for the info. For now, I just marked a bunch of things as "any" and I am making progress.

I knew you all didn't maintain it. I was hoping @saoudrizwan noticed my comment and pointed me in the right direction.

You know the standard internet protocol of relying on the help of strangers :)