toType

[ Function ]

Version 1.8

public static toType(
    value: any,
    typeString: string
): any | null;

Version 1.12

public static toType(
    value: any,
    typeName: string,
    options?: {
        readonly convertDirection?: ValueConverter.ConvertDirection;
    }
): any | null;

Converts any compatible value to a type defined by a type schema.

Parameter

Name

Type

Description

value

any

The value to convert.

Version 1.8

typeString

Version 1.12

typeName

string

The name of the type schema.

options [ optional ]

Available from version 1.12

 

{
    readonly convertDirection?: ValueConverter.ConvertDirection;
}

Settings

Return value

Type

Description

any, null

The value corresponding to the type schema name or null in the event of an error.

toType 1:

Available from 1.8