mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-16 07:58:10 +10:00
afd734dd61
Finding 5: Introduce V4Url + V4Section<T> type aliases in reactive-resume-v4-json.tsx; collapse
310-line V4ResumeData type (13x 5-field section header, 11x {label,href}) into typed aliases.
Inferred shape is structurally identical.
Finding 6: Remove 9 single-caller clamp/pxToPt wrappers; replace compile-time constants
(rotation=0, sidebarWidth=35, shadowWidth=0, gapX=4, gapY=6) with literals; inline dynamic
calls (clamp(x, 32, 512) etc.) at the two body/heading typography call sites.
Finding 7: Convert three stateless single-method importer classes to plain functions.
Extract shared rethrowAsImportError() to error.ts, replacing triplicated ZodError catch blocks.
Update web import dialog + all in-package test files to use function API.
Claude-Session: https://claude.ai/code/session_012Bnvt1MghwHj4qQRxuQUGa
10 lines
305 B
TypeScript
10 lines
305 B
TypeScript
import { flattenError, ZodError } from "zod";
|
|
|
|
/** Rethrows a ZodError as a serialized string error; re-throws other errors as-is. */
|
|
export function rethrowAsImportError(error: unknown): never {
|
|
if (error instanceof ZodError) {
|
|
throw new Error(JSON.stringify(flattenError(error)));
|
|
}
|
|
throw error;
|
|
}
|