Skip to content

Commit 0ae5c91

Browse files
committed
fix: typescript issues in examples
1 parent f0bad98 commit 0ae5c91

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/CardElement.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<form @submit.prevent="handlePay">
33
<StripeElements
44
v-if="stripeLoaded"
5+
class="py-3"
56
:stripe-key="publishableKey"
67
:instance-options="instanceOptions"
78
:elements-options="elementsOptions"
89
ref="elementsComponent"
9-
class="py-3"
1010
>
1111
<StripeElement
1212
type="card"
@@ -25,6 +25,7 @@
2525
<script setup lang="ts">
2626
import { loadStripe } from "@stripe/stripe-js"
2727
import type {
28+
StripeCardElement,
2829
StripeCardElementOptions,
2930
StripeConstructorOptions,
3031
StripeElementsOptions,
@@ -62,7 +63,7 @@ function handlePay() {
6263
// You need to implement backend for creating PaymentIntent
6364
// Learn more by reading https://docs.stripe.com/payments/card-element?lang=node
6465
const stripeInstance = elementsComponent.value?.instance
65-
const card = cardComponent.value?.stripeElement
66+
const card = cardComponent.value?.stripeElement as StripeCardElement
6667
6768
// Let's skip to the point you got clientSecret
6869
const clientSecret = "i_was_created_on_server"

examples/ExpressCheckoutElement.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const expressCheckoutComponent = useTemplateRef("expressCheckoutComponent")
5252
5353
const handleSomething = () => {
5454
const stripeInstance = elementsComponent.value?.instance
55-
const expressCheckout: StripeExpressCheckoutElement =
56-
expressCheckoutComponent.value?.stripeElement
55+
const expressCheckout = expressCheckoutComponent.value
56+
?.stripeElement as StripeExpressCheckoutElement
5757
5858
// do advanced stuff ...
5959
}

0 commit comments

Comments
 (0)