Home > @skunkteam/types > BaseTypeImpl > withParser
Define a new type with the same specs, but with the given parser and an optional new name.
Signature:
withParser(...args: [newConstructor: (i: unknown) => unknown] | [name: string, newConstructor: (i: unknown) => unknown] | [options: ParserOptions, newConstructor: (i: unknown) => unknown]): this;
Parameter | Type | Description |
---|---|---|
args | [newConstructor: (i: unknown) => unknown] | [name: string, newConstructor: (i: unknown) => unknown] | [options: ParserOptions, newConstructor: (i: unknown) => unknown] |
Returns:
this
This given parser may throw ValidationErrors to indicate validation failures during parsing.