Installing Type Definition for Stripe

Image by xresch from Pixabay



npm i -S @types/stripe

You can now type your Stripe API like this:

import { Stripe } from 'stripe'export function loadCustomersByEmail(email): Stripe.ApiListPromise<Stripe.Customer> {
return stripe.customers.list({ email })

Call the loadCustomerByEmail() function like this:

async function loadCustomers() {
const c:Stripe.ApiList<Stripe.Customer> =
await loadCustomersByEmail('')

Founder of Firefly Semantics Corporation