Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions cases/typia/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ToBeChecked {

const is = typia.createIs<ToBeChecked>();
const equals = typia.createEquals<ToBeChecked>();
const stringify = typia.createIsStringify<ToBeChecked>();
const stringify = typia.createStringify<ToBeChecked>();

export function assertLoose(input: unknown): boolean {
if (!is(input)) throw new Error('wrong type.');
Expand All @@ -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));
}