📚
utilsの整理整頓
1. 関数を機能ごとにファイルに分割
utils/calculate.ts
export const add = (a: number, b: number): number => a + b;
export const subtract = (a: number, b: number): number => a - b;
utils/format.ts
export const formatCurrency = (value: number): string => `$${value.toFixed(2)}`;
export const formatDate = (date: Date): string => date.toISOString().slice(0, 10);
2. index.tsからまとめてエクスポート
utils/index.ts
export * from './calculate';
export * from './format';
Discussion