fix: resolve all TypeScript errors in story files

Fix type mismatches, array access assertions, renamed conflicting
Error story exports, and corrected mock data to match domain types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Temuulen Ankhbayar 2026-03-07 17:47:38 +09:00
parent 57918a6d8c
commit e7d1371c48
11 changed files with 25 additions and 31 deletions

View File

@ -73,7 +73,7 @@ export const Empty: Story = {
export const SingleItem: Story = {
args: {
items: [mockItems[0]],
items: [mockItems[0]!],
currency: "USD",
},
};

View File

@ -108,7 +108,7 @@ export const Empty: Story = {
export const SingleInvoice: Story = {
args: {
invoices: [mockInvoices[0]],
invoices: [mockInvoices[0]!],
onInvoiceClick: () => {},
},
};

View File

@ -18,8 +18,8 @@ type Story = StoryObj<typeof PaymentForm>;
const sampleMethods = [
{
id: "pm-1",
type: "credit_card" as const,
id: 1,
type: "CreditCard" as const,
cardType: "visa",
cardLastFour: "4242",
expiryDate: "12/2027",
@ -27,8 +27,8 @@ const sampleMethods = [
description: "Visa ending in 4242",
},
{
id: "pm-2",
type: "credit_card" as const,
id: 2,
type: "CreditCard" as const,
cardType: "mastercard",
cardLastFour: "8888",
expiryDate: "06/2026",
@ -47,7 +47,7 @@ export const Default: Story = {
export const WithSelectedMethod: Story = {
args: {
existingMethods: sampleMethods,
selectedMethodId: "pm-1",
selectedMethodId: "1",
onMethodSelect: () => {},
},
};
@ -68,7 +68,7 @@ export const Loading: Story = {
export const Disabled: Story = {
args: {
existingMethods: sampleMethods,
selectedMethodId: "pm-1",
selectedMethodId: "1",
disabled: true,
},
};

View File

@ -41,14 +41,14 @@ export const WithTiers: Story = {
{
name: "Basic",
price: 2980,
billingCycle: "Month",
billingCycle: "Monthly",
description: "For light users",
features: ["100 Mbps", "Basic support"],
},
{
name: "Standard",
price: 4980,
billingCycle: "Month",
billingCycle: "Monthly",
description: "Most popular choice",
isRecommended: true,
features: ["500 Mbps", "Priority support", "Free router"],
@ -56,7 +56,7 @@ export const WithTiers: Story = {
{
name: "Premium",
price: 7980,
billingCycle: "Month",
billingCycle: "Monthly",
description: "For power users",
features: ["1 Gbps", "Dedicated support", "Free router", "Static IP"],
},

View File

@ -61,6 +61,6 @@ export const WithDefaultOpen: Story = {
export const SingleItem: Story = {
args: {
items: [sampleItems[0]],
items: [sampleItems[0]!],
},
};

View File

@ -15,12 +15,16 @@ const meta: Meta<typeof CompleteAccountStep> = {
email: "taro@example.com",
address: {
postcode: "100-0001",
prefecture: "Tokyo",
city: "Chiyoda-ku",
town: "Chiyoda",
prefectureJa: "\u6771\u4EAC\u90FD",
cityJa: "\u5343\u4EE3\u7530\u533A",
townJa: "\u5343\u4EE3\u7530",
streetAddress: "1-1-1",
buildingName: "",
roomNumber: "",
residenceType: "house",
},
},
accountData: {

View File

@ -59,7 +59,7 @@ export const Default: Story = {
export const WithSelection: Story = {
args: {
installations: mockInstallations,
selectedInstallation: mockInstallations[1],
selectedInstallation: mockInstallations[1] ?? null,
setSelectedInstallationSku: () => {},
isTransitioning: false,
onBack: () => {},

View File

@ -20,7 +20,6 @@ const mockPlan = {
simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false,
billingCycle: "Monthly" as const,
catalogMetadata: {},
};
const emptyMnpData = {
@ -39,13 +38,13 @@ const emptyMnpData = {
const baseArgs = {
plan: mockPlan,
loading: false,
simType: "" as const,
simType: "eSIM" as const,
setSimType: () => {},
eid: "",
setEid: () => {},
selectedAddons: [] as string[],
setSelectedAddons: () => {},
activationType: "" as const,
activationType: "Immediate" as const,
setActivationType: () => {},
scheduledActivationDate: "",
setScheduledActivationDate: () => {},
@ -66,7 +65,7 @@ export const Step1: Story = {
};
export const Step2: Story = {
args: { ...baseArgs, currentStep: 2, simType: "eSIM" },
args: { ...baseArgs, currentStep: 2, simType: "eSIM" as const },
};
export const Loading: Story = {
@ -74,5 +73,5 @@ export const Loading: Story = {
};
export const PlanNotFound: Story = {
args: { ...baseArgs, plan: undefined },
args: { ...baseArgs, plan: null },
};

View File

@ -21,7 +21,6 @@ const mockPlans = [
simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
{
id: "2",
@ -34,7 +33,6 @@ const mockPlans = [
simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
{
id: "3",
@ -47,7 +45,6 @@ const mockPlans = [
simPlanType: "DataOnly" as const,
simHasFamilyDiscount: false,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
];
@ -75,12 +72,12 @@ export const Loading: Story = {
},
};
export const Error: Story = {
export const ErrorState: Story = {
args: {
variant: "public",
plans: [],
isLoading: false,
error: new Error("Failed to fetch SIM plans"),
error: new globalThis.Error("Failed to fetch SIM plans"),
activeTab: "data-voice",
onTabChange: () => {},
onSelectPlan: () => {},
@ -103,7 +100,6 @@ export const AccountVariant: Story = {
simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: true,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
],
isLoading: false,

View File

@ -19,7 +19,6 @@ export const UsPlan: Story = {
unitPrice: 2500,
oneTimePrice: 0,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
},
};
@ -34,7 +33,6 @@ export const UkPlan: Story = {
unitPrice: 2500,
oneTimePrice: 0,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
},
};

View File

@ -18,7 +18,6 @@ const mockPlans = [
unitPrice: 2500,
oneTimePrice: 0,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
{
id: "vpn-2",
@ -28,7 +27,6 @@ const mockPlans = [
unitPrice: 2500,
oneTimePrice: 0,
billingCycle: "Monthly" as const,
catalogMetadata: {},
},
];
@ -41,7 +39,6 @@ const mockActivationFees = [
unitPrice: 3000,
oneTimePrice: 3000,
billingCycle: "OneTime" as const,
catalogMetadata: {},
},
];
@ -75,13 +72,13 @@ export const Loading: Story = {
},
};
export const Error: Story = {
export const ErrorState: Story = {
args: {
variant: "public",
plans: [],
activationFees: [],
isLoading: false,
error: new Error("Failed to load VPN plans"),
error: new globalThis.Error("Failed to load VPN plans"),
},
};