Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 1.46 KB

types.basetypeimpl.withparser.md

File metadata and controls

27 lines (16 loc) · 1.46 KB

Home > @skunkteam/types > BaseTypeImpl > withParser

BaseTypeImpl.withParser() method

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;

Parameters

Parameter Type Description
args [newConstructor: (i: unknown) => unknown] | [name: string, newConstructor: (i: unknown) => unknown] | [options: ParserOptions, newConstructor: (i: unknown) => unknown]

Returns:

this

Remarks

This given parser may throw ValidationErrors to indicate validation failures during parsing.