After installing @types/stripe-v3
and including Stripe's javascript file in a script tag within index.html
, I expected the Angular compiler to automatically include all files from the @types node modules. According to my research, and after inspecting @types/stripe-v3/index.d.ts
, there should be a globally declared variable named Stripe if the file is successfully included by the compiler. Inside index.d.ts
declare var Stripe: stripe.StripeStatic;
In my service file, the code looks like this:
import { Injectable } from '@angular/core';
import { environment } from '../environments/environment';
@Injectable({
providedIn: 'root'
})
export class BetalingService {
stripe = Stripe(environment.stripeKey);
constructor() { }
}
However, this results in the following error:
error TS2304: Cannot find name 'Stripe'.