0

I'm trying to make a system that uses the Payment Request Api and for the most part its successful, but TypeScript doesn't seem to have a definition for canMakePayment under the PaymentRequest object.

Am I missing something or do I need to cast it to any so my Typescript builds?

Thanks

Andrew Davis
  • 460
  • 3
  • 17

2 Answers2

1

I found canMakePayment() entry in TypeScript's code.

https://github.com/Microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts#L9737

I'm not a TypeScript expert but I assume you can import this?

agektmr
  • 2,144
  • 15
  • 14
0

I would recommend writing a small .d.ts file and reference that while the library type definitions do not include the complete interface yet.

i.e. containing something like:

declare interface PaymentRequest
{
    canMakePayment(): boolean; // Or whatever the correct type signature is.
}

If you place it in an @types directory it might be picked up automatically. Else use a reference comment, e.g. /// <reference path="payment-request-extension.d.ts" />.

H.B.
  • 166,899
  • 29
  • 327
  • 400