ethereumjs-monorepo

@ethereumjs/util


@ethereumjs/util / toType

Function: toType()

Coerce an input value to a selected output representation.

Call Signature

toType<T>(input, outputType): null

Defined in: packages/util/src/types.ts:81

Convert an input to a specified type. Input of null/undefined returns null/undefined regardless of the output type.

Type Parameters

T

T extends TypeOutput

Parameters

input

null

value to convert

outputType

T

type to output

Returns

null

Call Signature

toType<T>(input, outputType): undefined

Defined in: packages/util/src/types.ts:83

Coerce an input value to a selected output representation.

Type Parameters

T

T extends TypeOutput

Parameters

input

undefined

outputType

T

Returns

undefined

Call Signature

toType<T>(input, outputType): TypeOutputReturnType[T]

Defined in: packages/util/src/types.ts:85

Coerce an input value to a selected output representation.

Type Parameters

T

T extends TypeOutput

Parameters

input

ToBytesInputTypes

outputType

T

Returns

TypeOutputReturnType[T]