Skip to content

Commit 2f52cad

Browse files
authored
fix(ui): Run type-check on build (#8076)
1 parent d8eed1b commit 2f52cad

13 files changed

Lines changed: 53 additions & 30 deletions

File tree

.changeset/clean-views-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix minor internal issues with TypeScript types.

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"register"
7070
],
7171
"scripts": {
72-
"build": "pnpm build:umd && pnpm build:esm && pnpm check:no-rhc",
72+
"build": "pnpm build:umd && pnpm build:esm && pnpm check:no-rhc && pnpm type-check",
7373
"build:analyze": "rspack build --config rspack.config.js --env production --env analyze --analyze",
7474
"build:esm": "tsdown",
7575
"build:rsdoctor": "RSDOCTOR=true rspack build --config rspack.config.js --env production",

packages/ui/src/Components.tsx

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ import type {
88
__internal_UserVerificationProps,
99
Clerk,
1010
ClerkOptions,
11-
CreateOrganizationProps,
11+
CreateOrganizationModalProps,
1212
EnvironmentResource,
1313
GoogleOneTapProps,
14-
OrganizationProfileProps,
14+
OrganizationProfileModalProps,
1515
SignInProps,
16+
SignInModalProps,
1617
SignUpProps,
18+
SignUpModalProps,
19+
UserProfileModalProps,
1720
UserProfileProps,
1821
WaitlistProps,
22+
WaitlistModalProps,
1923
} from '@clerk/shared/types';
2024
import { createDeferredPromise } from '@clerk/shared/utils';
2125
import React, { Suspense, useCallback, useRef, useSyncExternalStore } from 'react';
@@ -161,16 +165,16 @@ interface ComponentsState {
161165
appearance: Appearance | undefined;
162166
options: ClerkOptions | undefined;
163167
googleOneTapModal: null | GoogleOneTapProps;
164-
signInModal: null | SignInProps;
165-
signUpModal: null | SignUpProps;
166-
userProfileModal: null | UserProfileProps;
168+
signInModal: null | SignInModalProps;
169+
signUpModal: null | SignUpModalProps;
170+
userProfileModal: null | UserProfileModalProps;
167171
userVerificationModal: null | __internal_UserVerificationProps;
168-
organizationProfileModal: null | OrganizationProfileProps;
169-
createOrganizationModal: null | CreateOrganizationProps;
172+
organizationProfileModal: null | OrganizationProfileModalProps;
173+
createOrganizationModal: null | CreateOrganizationModalProps;
170174
enableOrganizationsPromptModal: null | __internal_EnableOrganizationsPromptProps;
171175
blankCaptchaModal: null;
172176
organizationSwitcherPrefetch: boolean;
173-
waitlistModal: null | WaitlistProps;
177+
waitlistModal: null | WaitlistModalProps;
174178
checkoutDrawer: {
175179
open: false;
176180
props: null | __internal_CheckoutProps;
@@ -502,7 +506,7 @@ const Components = (props: ComponentsProps) => {
502506
onClose={() => componentsControls.closeModal('signIn')}
503507
onExternalNavigate={() => componentsControls.closeModal('signIn')}
504508
startPath={buildVirtualRouterUrl({ base: '/sign-in', path: urlStateParam?.path })}
505-
getContainer={signInModal?.getContainer}
509+
getContainer={signInModal?.getContainer ?? (() => null)}
506510
componentName={'SignInModal'}
507511
>
508512
<SignInModal {...signInModal} />
@@ -520,7 +524,7 @@ const Components = (props: ComponentsProps) => {
520524
onClose={() => componentsControls.closeModal('signUp')}
521525
onExternalNavigate={() => componentsControls.closeModal('signUp')}
522526
startPath={buildVirtualRouterUrl({ base: '/sign-up', path: urlStateParam?.path })}
523-
getContainer={signUpModal?.getContainer}
527+
getContainer={signUpModal?.getContainer ?? (() => null)}
524528
componentName={'SignUpModal'}
525529
>
526530
<SignInModal {...disambiguateRedirectOptions(signUpModal, 'signup')} />
@@ -541,7 +545,7 @@ const Components = (props: ComponentsProps) => {
541545
base: '/user',
542546
path: userProfileModal?.__experimental_startPath || urlStateParam?.path,
543547
})}
544-
getContainer={userProfileModal?.getContainer}
548+
getContainer={userProfileModal?.getContainer ?? (() => null)}
545549
componentName={'UserProfileModal'}
546550
modalContainerSx={{ alignItems: 'center' }}
547551
modalContentSx={t => ({ height: `min(${t.sizes.$176}, calc(100% - ${t.sizes.$12}))`, margin: 0 })}
@@ -559,7 +563,7 @@ const Components = (props: ComponentsProps) => {
559563
onClose={() => componentsControls.closeModal('userVerification')}
560564
onExternalNavigate={() => componentsControls.closeModal('userVerification')}
561565
startPath={buildVirtualRouterUrl({ base: '/user-verification', path: urlStateParam?.path })}
562-
getContainer={userVerificationModal?.getContainer}
566+
getContainer={userVerificationModal?.getContainer ?? (() => null)}
563567
componentName={'UserVerificationModal'}
564568
modalContainerSx={{ alignItems: 'center' }}
565569
>
@@ -579,7 +583,7 @@ const Components = (props: ComponentsProps) => {
579583
base: '/organizationProfile',
580584
path: organizationProfileModal?.__experimental_startPath || urlStateParam?.path,
581585
})}
582-
getContainer={organizationProfileModal?.getContainer}
586+
getContainer={organizationProfileModal?.getContainer ?? (() => null)}
583587
componentName={'OrganizationProfileModal'}
584588
modalContainerSx={{ alignItems: 'center' }}
585589
modalContentSx={t => ({ height: `min(${t.sizes.$176}, calc(100% - ${t.sizes.$12}))`, margin: 0 })}
@@ -597,7 +601,7 @@ const Components = (props: ComponentsProps) => {
597601
onClose={() => componentsControls.closeModal('createOrganization')}
598602
onExternalNavigate={() => componentsControls.closeModal('createOrganization')}
599603
startPath={buildVirtualRouterUrl({ base: '/createOrganization', path: urlStateParam?.path })}
600-
getContainer={createOrganizationModal?.getContainer}
604+
getContainer={createOrganizationModal?.getContainer ?? (() => null)}
601605
componentName={'CreateOrganizationModal'}
602606
modalContainerSx={{ alignItems: 'center' }}
603607
modalContentSx={t => ({ height: `min(${t.sizes.$120}, calc(100% - ${t.sizes.$12}))`, margin: 0 })}
@@ -615,7 +619,7 @@ const Components = (props: ComponentsProps) => {
615619
onClose={() => componentsControls.closeModal('waitlist')}
616620
onExternalNavigate={() => componentsControls.closeModal('waitlist')}
617621
startPath={buildVirtualRouterUrl({ base: '/waitlist', path: urlStateParam?.path })}
618-
getContainer={waitlistModal?.getContainer}
622+
getContainer={waitlistModal?.getContainer ?? (() => null)}
619623
componentName={'WaitlistModal'}
620624
>
621625
<WaitlistModal {...waitlistModal} />
@@ -638,6 +642,7 @@ const Components = (props: ComponentsProps) => {
638642
canCloseModal={false}
639643
modalId={'cl-modal-captcha-wrapper'}
640644
modalStyle={{ visibility: 'hidden', pointerEvents: 'none' }}
645+
getContainer={() => null}
641646
>
642647
<BlankCaptchaModal />
643648
</LazyModalRenderer>

packages/ui/src/components/Checkout/CheckoutForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export const CheckoutForm = withCardStateProvider(() => {
4242

4343
const fee =
4444
planPeriod === 'month'
45-
? plan.fee
45+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
46+
plan.fee!
4647
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
4748
plan.annualMonthlyFee!;
4849

packages/ui/src/components/PaymentAttempts/PaymentAttemptPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ function PaymentAttemptBody({ subscriptionItem }: { subscriptionItem: BillingSub
205205

206206
const fee =
207207
subscriptionItem.planPeriod === 'month'
208-
? subscriptionItem.plan.fee
208+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
209+
subscriptionItem.plan.fee!
209210
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
210211
subscriptionItem.plan.annualMonthlyFee!;
211212

packages/ui/src/components/PricingTable/PricingTableMatrix.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ export function PricingTableMatrix({
157157
{plans.map(plan => {
158158
const highlight = plan.slug === highlightedPlan;
159159
const planFee = !plan.annualMonthlyFee
160-
? plan.fee
160+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
161+
plan.fee!
161162
: planPeriod === 'annual'
162163
? plan.annualMonthlyFee
163-
: plan.fee;
164+
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
165+
plan.fee!;
164166

165167
return (
166168
<Box

packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { OrganizationCreationDefaultsAlert } from './OrganizationCreationDefault
2626

2727
type CreateOrganizationScreenProps = {
2828
onCancel?: () => void;
29-
organizationCreationDefaults?: OrganizationCreationDefaultsResource;
29+
organizationCreationDefaults?: OrganizationCreationDefaultsResource | null;
3030
};
3131

3232
export const CreateOrganizationScreen = (props: CreateOrganizationScreenProps) => {

packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { localizationKeys } from '@/localization';
66
export function OrganizationCreationDefaultsAlert({
77
organizationCreationDefaults,
88
}: {
9-
organizationCreationDefaults?: OrganizationCreationDefaultsResource;
9+
organizationCreationDefaults?: OrganizationCreationDefaultsResource | null;
1010
}) {
1111
const localizationKey = advisoryToLocalizationKey(organizationCreationDefaults?.advisory);
1212
if (!localizationKey) {

packages/ui/src/components/SessionTasks/tasks/TaskSetupMfa/SetupMfaStartScreen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const SetupMfaStartScreen = withCardStateProvider((props: SetupMfaStartSc
6060
})}
6161
>
6262
{availableMethods.map(method => {
63-
const methodConfig = METHOD_CONFIG[method] ?? null;
63+
const methodConfig = METHOD_CONFIG[method as keyof typeof METHOD_CONFIG] ?? null;
6464

6565
if (!methodConfig) {
6666
return null;

packages/ui/src/components/SubscriptionDetails/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,10 @@ const SubscriptionCardActions = ({ subscription }: { subscription: BillingSubscr
416416
currency: subscription.plan.annualFee!.currencySymbol,
417417
})
418418
: localizationKeys('billing.switchToMonthlyWithPrice', {
419-
price: normalizeFormatted(subscription.plan.fee.amountFormatted),
420-
currency: subscription.plan.fee.currencySymbol,
419+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
420+
price: normalizeFormatted(subscription.plan.fee!.amountFormatted),
421+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
422+
currency: subscription.plan.fee!.currencySymbol,
421423
}),
422424
onClick: () => {
423425
openCheckout({
@@ -509,7 +511,8 @@ const SubscriptionCard = ({ subscription }: { subscription: BillingSubscriptionI
509511

510512
const fee =
511513
subscription.planPeriod === 'month'
512-
? subscription.plan.fee
514+
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
515+
subscription.plan.fee!
513516
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
514517
subscription.plan.annualFee!;
515518

0 commit comments

Comments
 (0)