Skip to content

Commit 3c9e2f6

Browse files
Test that implementation and module type definitions match (stripe#12)
1 parent 857a215 commit 3c9e2f6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/types/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ import {
3939
const stripePromise: Promise<Stripe | null> = loadStripe('');
4040
const stripeConnectPromise = loadStripe('', {stripeAccount: '', locale: 'en'});
4141

42+
type TypeModule = typeof import('@stripe/stripe-js');
43+
type SrcModule = typeof import('../../src/index');
44+
45+
// Makes sure that the implementation matches the type definitions
46+
// Checking for compatibility both ways ensures that the exports
47+
// are equivalent with nothing missing on either side.
48+
import('../../src/index').then((srcModule: TypeModule) => {});
49+
import('@stripe/stripe-js').then((typeModule: SrcModule) => {});
50+
4251
declare const stripe: Stripe;
4352

4453
const OPEN_SANS: CssFontSource = {

0 commit comments

Comments
 (0)