True Myth / standard-schema / AsyncParserFor
Type Alias: AsyncParserFor()<T>
AsyncParserFor<
T> = (data) =>ParseTask<T>
A type to name an async parser, most often used in conjunction with asyncParserFor. Helpful if you want to use a type you have written to constrain a Standard Schema-compatible async schema, instead of creating the type from the schema.
Example
ts
import { parserFor, type ParserFor } from 'true-myth/standard-schema';
import { type } from 'arktype';
interface Person {
name?: string | undefined;
age: number;
}
const personParser: ParserFor<Person> = parserFor(type({
"name?": "string",
age: "number>=0",
}));Type Parameters
T
T
Parameters
data
unknown
Returns
ParseTask<T>