diff --git a/cases/typia/src/index.ts b/cases/typia/src/index.ts index a42175194..a823029a1 100644 --- a/cases/typia/src/index.ts +++ b/cases/typia/src/index.ts @@ -16,7 +16,7 @@ interface ToBeChecked { const is = typia.createIs(); const equals = typia.createEquals(); -const stringify = typia.createIsStringify(); +const stringify = typia.createStringify(); export function assertLoose(input: unknown): boolean { if (!is(input)) throw new Error('wrong type.'); @@ -34,7 +34,6 @@ export function parseStrict(input: unknown): ToBeChecked { } export function parseSafe(input: unknown): ToBeChecked { - const json: string | null = stringify(input); - if (json === null) throw new Error('wrong type.'); - return JSON.parse(json); + if (!is(input)) throw new Error('wrong type.'); + return JSON.parse(stringify(input)); }