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 = { export const SingleItem: Story = {
args: { args: {
items: [mockItems[0]], items: [mockItems[0]!],
currency: "USD", currency: "USD",
}, },
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,7 +20,6 @@ const mockPlan = {
simPlanType: "DataSmsVoice" as const, simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false, simHasFamilyDiscount: false,
billingCycle: "Monthly" as const, billingCycle: "Monthly" as const,
catalogMetadata: {},
}; };
const emptyMnpData = { const emptyMnpData = {
@ -39,13 +38,13 @@ const emptyMnpData = {
const baseArgs = { const baseArgs = {
plan: mockPlan, plan: mockPlan,
loading: false, loading: false,
simType: "" as const, simType: "eSIM" as const,
setSimType: () => {}, setSimType: () => {},
eid: "", eid: "",
setEid: () => {}, setEid: () => {},
selectedAddons: [] as string[], selectedAddons: [] as string[],
setSelectedAddons: () => {}, setSelectedAddons: () => {},
activationType: "" as const, activationType: "Immediate" as const,
setActivationType: () => {}, setActivationType: () => {},
scheduledActivationDate: "", scheduledActivationDate: "",
setScheduledActivationDate: () => {}, setScheduledActivationDate: () => {},
@ -66,7 +65,7 @@ export const Step1: Story = {
}; };
export const Step2: Story = { export const Step2: Story = {
args: { ...baseArgs, currentStep: 2, simType: "eSIM" }, args: { ...baseArgs, currentStep: 2, simType: "eSIM" as const },
}; };
export const Loading: Story = { export const Loading: Story = {
@ -74,5 +73,5 @@ export const Loading: Story = {
}; };
export const PlanNotFound: 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, simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false, simHasFamilyDiscount: false,
billingCycle: "Monthly" as const, billingCycle: "Monthly" as const,
catalogMetadata: {},
}, },
{ {
id: "2", id: "2",
@ -34,7 +33,6 @@ const mockPlans = [
simPlanType: "DataSmsVoice" as const, simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: false, simHasFamilyDiscount: false,
billingCycle: "Monthly" as const, billingCycle: "Monthly" as const,
catalogMetadata: {},
}, },
{ {
id: "3", id: "3",
@ -47,7 +45,6 @@ const mockPlans = [
simPlanType: "DataOnly" as const, simPlanType: "DataOnly" as const,
simHasFamilyDiscount: false, simHasFamilyDiscount: false,
billingCycle: "Monthly" as const, billingCycle: "Monthly" as const,
catalogMetadata: {},
}, },
]; ];
@ -75,12 +72,12 @@ export const Loading: Story = {
}, },
}; };
export const Error: Story = { export const ErrorState: Story = {
args: { args: {
variant: "public", variant: "public",
plans: [], plans: [],
isLoading: false, isLoading: false,
error: new Error("Failed to fetch SIM plans"), error: new globalThis.Error("Failed to fetch SIM plans"),
activeTab: "data-voice", activeTab: "data-voice",
onTabChange: () => {}, onTabChange: () => {},
onSelectPlan: () => {}, onSelectPlan: () => {},
@ -103,7 +100,6 @@ export const AccountVariant: Story = {
simPlanType: "DataSmsVoice" as const, simPlanType: "DataSmsVoice" as const,
simHasFamilyDiscount: true, simHasFamilyDiscount: true,
billingCycle: "Monthly" as const, billingCycle: "Monthly" as const,
catalogMetadata: {},
}, },
], ],
isLoading: false, isLoading: false,

View File

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

View File

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