richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
217 stars 77 forks source link

Type error using stripe and ngx-stripe #260

Open JohnSQI opened 1 month ago

JohnSQI commented 1 month ago

Describe the bug When I'm trying to follow installation guide, I get type error (see below).

To Reproduce Steps to reproduce the behavior:

  1. npm install ngx-stripe @stripe/stripe-js
  2. In app.module.ts add imports: NgxStripeModule.forRoot(),

Expected behavior Angualar npm start compiled successfully.

Screenshots Error: node_modules/ngx-stripe/lib/services/stripe-instance.class.d.ts:162:5 - error TS2416: Property 'handleCardPayment' in type 'StripeInstance' is not assignable to the same property in base type 'StripeServiceInterface'. Type '(clientSecret: string, element?: any, data?: any) => Observable' is not assignable to type '(clientSecret: string, element?: any, data?: any) => Observable<{ paymentIntent?: PaymentIntent; error?: StripeError; }>'. Type 'Observable' is not assignable to type 'Observable<{ paymentIntent?: PaymentIntent; error?: StripeError; }>'. Type 'PaymentIntentResult' is not assignable to type '{ paymentIntent?: PaymentIntent; error?: StripeError; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. Type '{ paymentIntent: PaymentIntent; error?: undefined; }' is not assignable to type '{ paymentIntent?: PaymentIntent; error?: StripeError; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. Types of property 'error' are incompatible. Type 'undefined' is not assignable to type 'StripeError'.

162 handleCardPayment(clientSecret: string, element?: any, data?: any): Observable;



Any tips on how to avoid that ?