unsafeParse<T>(schema: Schema<T>, input: unknown): T
schema: Schema<T>
input: unknown
import { x } from 'unhoax'const result = x.unsafeParse(x.string, 'hello')// 'hello'try { x.unsafeParse(x.number, 'hello')} catch (error) { error // Error error.cause // x.ParseError error.cause.issues // x.ParseIssue[]} Copy
import { x } from 'unhoax'const result = x.unsafeParse(x.string, 'hello')// 'hello'try { x.unsafeParse(x.number, 'hello')} catch (error) { error // Error error.cause // x.ParseError error.cause.issues // x.ParseIssue[]}
Example