Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 2.44 KB

types.simpletype.create_1.md

File metadata and controls

26 lines (17 loc) · 2.44 KB

Home > @skunkteam/types > SimpleType > create

SimpleType.create() method

Create a simple (limited) type implementation.

Signature:

static create<ResultType>(name: string, basicType: BasicType | 'mixed', simpleValidator: (input: unknown, options: ValidationOptions, type: SimpleType<ResultType, undefined>) => ValidationResult, options?: Omit<SimpleTypeOptions<ResultType, undefined>, 'typeConfig'>): Type<ResultType, undefined>;

Parameters

Parameter Type Description
name string the name for the Type
basicType BasicType | 'mixed' the fixed basic type of the Type
simpleValidator (input: unknown, options: ValidationOptions, type: SimpleType<ResultType, undefined>) => ValidationResult validation logic
options Omit<SimpleTypeOptions<ResultType, undefined>, 'typeConfig'> (Optional) some optional features of BaseTypeImpl

Returns:

Type<ResultType, undefined>