Type Utils
Preparing search index...
Schema
Variable Schema
Const
Schema
:
{
and
:
{
<
T1
,
T2
>
(
guard1
:
TypeGuard
<
T1
>
,
guard2
:
TypeGuard
<
T2
>
,
)
:
TypeGuard
<
Merge
<
T1
,
T2
>
>
;
<
TGuards
extends
TypeGuards
<
any
>
>
(
...
guards
:
TGuards
,
)
:
TypeGuard
<
TIntersection
<
GetTypeGuards
<
TGuards
>
>
>
;
}
&
{
optional
:
OptionalizedAnd
}
;
any
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
any
>
>
;
array
:
{
()
:
TypeGuard
<
any
[]
>
;
(
rules
:
ArrayRule
[]
)
:
TypeGuard
<
any
[]
>
;
<
T
>
(
rules
:
ArrayRule
[]
,
schema
:
TypeGuard
<
T
>
)
:
TypeGuard
<
T
[]
>
;
<
T
>
(
schema
:
TypeGuard
<
T
>
)
:
TypeGuard
<
T
[]
>
;
(
tree
:
{}
)
:
TypeGuard
<
{}
[]
>
;
<
T
>
(
tree
:
ValidatorMap
<
T
>
)
:
TypeGuard
<
T
[]
>
;
<
T
>
(
rules
?:
null
|
ArrayRule
[]
|
TypeGuard
<
T
>
,
schema
?:
TypeGuard
<
T
>
,
)
:
TypeGuard
<
T
[]
>
;
}
&
{
optional
:
OptionalizedArray
}
;
asEnum
:
OptionalizedTypeGuardFactory
<
<
T
extends
PrimitiveType
>
(
values
:
T
[]
)
=>
TypeGuard
<
T
>
,
>
;
asNull
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
null
>
>
;
asUndefined
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
undefined
>
>
;
bigint
:
{
()
:
TypeGuard
<
bigint
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
bigint
>
;
(
rules
:
NumberRule
[]
)
:
TypeGuard
<
bigint
>
;
}
&
{
optional
:
OptionalizedBigInt
}
;
boolean
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
boolean
>
>
;
getStructMetadata
:
<
U
>
(
guard
:
TypeGuard
<
U
>
,
)
=>
V3
.
AnyStruct
|
V3
.
GenericStruct
<
U
,
true
>
;
number
:
{
()
:
TypeGuard
<
number
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
number
>
;
(
rules
:
NumberRule
[]
)
:
TypeGuard
<
number
>
;
}
&
{
optional
:
OptionalizedNumber
}
;
object
:
{
<
T
extends
{}
>
(
tree
:
ValidatorMap
<
T
>
)
:
TypeGuard
<
Sanitize
<
T
>
>
;
()
:
TypeGuard
<
Record
<
any
,
any
>
>
;
(
tree
:
{}
)
:
TypeGuard
<
{}
>
;
}
&
{
optional
:
OptionalizedObject
}
;
optionalize
:
{
<
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
:
OptionalizedTypeGuardFactory
<
Factory
>
;
<
Override
,
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
:
Factory
&
{
optional
:
Override
}
;
}
;
optionalizeOverloadFactory
:
<
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
=>
{
optionalize
<
Override
>
()
:
Factory
&
{
optional
:
Override
}
}
;
or
:
{
<
T1
,
T2
>
(
guard1
:
TypeGuard
<
T1
>
,
guard2
:
TypeGuard
<
T2
>
,
)
:
TypeGuard
<
T1
|
T2
>
;
<
TGuards
extends
TypeGuards
<
any
>
>
(
...
guards
:
TGuards
,
)
:
TypeGuard
<
TUnion
<
GetTypeGuards
<
TGuards
>
>
>
;
}
&
{
optional
:
OptionalizedOr
}
;
primitive
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
PrimitiveType
>
>
;
record
:
{
()
:
TypeGuard
<
Record
<
string
,
any
>
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
Record
<
string
,
any
>
>
;
(
rules
:
RecordRule
[]
)
:
TypeGuard
<
Record
<
string
,
any
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
rules
:
Partial
<
Rules
>
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
rules
:
RecordRule
[]
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
}
&
{
optional
:
OptionalizedRecord
}
;
setStructMetadata
:
{
<
TSource
>
(
struct
:
V3
.
GenericStruct
<
TSource
,
false
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TSource
extends
PrimitiveType
>
(
struct
:
V3
.
EnumStruct
<
TSource
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
(
struct
:
V3
.
PrimitiveStruct
,
guard
:
TypeGuard
<
PrimitiveType
>
,
)
:
TypeGuard
<
PrimitiveType
>
;
<
TSource
extends
{}
>
(
struct
:
V3
.
ObjectStruct
<
TSource
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TSource
>
(
struct
:
V3
.
ArrayStruct
<
TypeFromArray
<
TSource
>
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TStruct
extends
RecordStruct
<
any
,
any
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromRecordStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromRecordStruct
<
TStruct
>
>
;
<
TKey
extends
string
|
number
|
symbol
,
TValue
>
(
struct
:
RecordStruct
<
TKey
,
TValue
>
,
guard
:
TypeGuard
<
Record
<
TKey
,
TValue
>
>
,
)
:
TypeGuard
<
Record
<
TKey
,
TValue
>
>
;
<
TStruct
extends
V3
.
UnionStruct
<
any
[]
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromUnionStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromUnionStruct
<
TStruct
>
>
;
<
TStruct
extends
V3
.
IntersectionStruct
<
any
[]
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromIntersectionStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromIntersectionStruct
<
TStruct
>
>
;
}
;
string
:
{
()
:
TypeGuard
<
string
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
string
>
;
(
rules
:
StringRule
[]
)
:
TypeGuard
<
string
>
;
<
T
extends
string
>
(
matches
:
T
)
:
TypeGuard
<
T
>
;
(
regex
:
RegExp
)
:
TypeGuard
<
string
>
;
}
&
{
optional
:
OptionalizedString
}
;
symbol
:
()
=>
TypeGuard
<
symbol
>
&
{
optional
:
OptionalizedSymbol
}
;
useSchema
:
OptionalizedTypeGuardFactory
<
<
T
>
(
schema
:
TypeGuard
<
T
>
)
=>
TypeGuard
<
T
>
,
>
;
}
= ...
Type declaration
and
:
{
<
T1
,
T2
>
(
guard1
:
TypeGuard
<
T1
>
,
guard2
:
TypeGuard
<
T2
>
,
)
:
TypeGuard
<
Merge
<
T1
,
T2
>
>
;
<
TGuards
extends
TypeGuards
<
any
>
>
(
...
guards
:
TGuards
,
)
:
TypeGuard
<
TIntersection
<
GetTypeGuards
<
TGuards
>
>
>
;
}
&
{
optional
:
OptionalizedAnd
}
any
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
any
>
>
array
:
{
()
:
TypeGuard
<
any
[]
>
;
(
rules
:
ArrayRule
[]
)
:
TypeGuard
<
any
[]
>
;
<
T
>
(
rules
:
ArrayRule
[]
,
schema
:
TypeGuard
<
T
>
)
:
TypeGuard
<
T
[]
>
;
<
T
>
(
schema
:
TypeGuard
<
T
>
)
:
TypeGuard
<
T
[]
>
;
(
tree
:
{}
)
:
TypeGuard
<
{}
[]
>
;
<
T
>
(
tree
:
ValidatorMap
<
T
>
)
:
TypeGuard
<
T
[]
>
;
<
T
>
(
rules
?:
null
|
ArrayRule
[]
|
TypeGuard
<
T
>
,
schema
?:
TypeGuard
<
T
>
,
)
:
TypeGuard
<
T
[]
>
;
}
&
{
optional
:
OptionalizedArray
}
asEnum
:
OptionalizedTypeGuardFactory
<
<
T
extends
PrimitiveType
>
(
values
:
T
[]
)
=>
TypeGuard
<
T
>
,
>
asNull
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
null
>
>
asUndefined
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
undefined
>
>
bigint
:
{
()
:
TypeGuard
<
bigint
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
bigint
>
;
(
rules
:
NumberRule
[]
)
:
TypeGuard
<
bigint
>
;
}
&
{
optional
:
OptionalizedBigInt
}
boolean
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
boolean
>
>
getStructMetadata
:
<
U
>
(
guard
:
TypeGuard
<
U
>
)
=>
V3
.
AnyStruct
|
V3
.
GenericStruct
<
U
,
true
>
number
:
{
()
:
TypeGuard
<
number
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
number
>
;
(
rules
:
NumberRule
[]
)
:
TypeGuard
<
number
>
;
}
&
{
optional
:
OptionalizedNumber
}
object
:
{
<
T
extends
{}
>
(
tree
:
ValidatorMap
<
T
>
)
:
TypeGuard
<
Sanitize
<
T
>
>
;
()
:
TypeGuard
<
Record
<
any
,
any
>
>
;
(
tree
:
{}
)
:
TypeGuard
<
{}
>
;
}
&
{
optional
:
OptionalizedObject
}
optionalize
:
{
<
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
:
OptionalizedTypeGuardFactory
<
Factory
>
;
<
Override
,
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
:
Factory
&
{
optional
:
Override
}
;
}
optionalizeOverloadFactory
:
<
Factory
extends
TypeGuardFactory
>
(
factory
:
Factory
,
)
=>
{
optionalize
<
Override
>
()
:
Factory
&
{
optional
:
Override
}
}
or
:
{
<
T1
,
T2
>
(
guard1
:
TypeGuard
<
T1
>
,
guard2
:
TypeGuard
<
T2
>
,
)
:
TypeGuard
<
T1
|
T2
>
;
<
TGuards
extends
TypeGuards
<
any
>
>
(
...
guards
:
TGuards
,
)
:
TypeGuard
<
TUnion
<
GetTypeGuards
<
TGuards
>
>
>
;
}
&
{
optional
:
OptionalizedOr
}
primitive
:
OptionalizedTypeGuardFactory
<
()
=>
TypeGuard
<
PrimitiveType
>
>
record
:
{
()
:
TypeGuard
<
Record
<
string
,
any
>
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
Record
<
string
,
any
>
>
;
(
rules
:
RecordRule
[]
)
:
TypeGuard
<
Record
<
string
,
any
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
rules
:
Partial
<
Rules
>
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
<
K
extends
string
|
number
|
symbol
,
T
>
(
keyGuard
:
TypeGuard
<
K
>
,
valueGuard
:
TypeGuard
<
T
>
,
rules
:
RecordRule
[]
,
)
:
TypeGuard
<
Record
<
K
,
T
>
>
;
}
&
{
optional
:
OptionalizedRecord
}
setStructMetadata
:
{
<
TSource
>
(
struct
:
V3
.
GenericStruct
<
TSource
,
false
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TSource
extends
PrimitiveType
>
(
struct
:
V3
.
EnumStruct
<
TSource
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
(
struct
:
V3
.
PrimitiveStruct
,
guard
:
TypeGuard
<
PrimitiveType
>
,
)
:
TypeGuard
<
PrimitiveType
>
;
<
TSource
extends
{}
>
(
struct
:
V3
.
ObjectStruct
<
TSource
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TSource
>
(
struct
:
V3
.
ArrayStruct
<
TypeFromArray
<
TSource
>
>
,
guard
:
TypeGuard
<
TSource
>
,
)
:
TypeGuard
<
TSource
>
;
<
TStruct
extends
RecordStruct
<
any
,
any
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromRecordStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromRecordStruct
<
TStruct
>
>
;
<
TKey
extends
string
|
number
|
symbol
,
TValue
>
(
struct
:
RecordStruct
<
TKey
,
TValue
>
,
guard
:
TypeGuard
<
Record
<
TKey
,
TValue
>
>
,
)
:
TypeGuard
<
Record
<
TKey
,
TValue
>
>
;
<
TStruct
extends
V3
.
UnionStruct
<
any
[]
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromUnionStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromUnionStruct
<
TStruct
>
>
;
<
TStruct
extends
V3
.
IntersectionStruct
<
any
[]
>
>
(
struct
:
TStruct
,
guard
:
TypeGuard
<
FromIntersectionStruct
<
TStruct
>
>
,
)
:
TypeGuard
<
FromIntersectionStruct
<
TStruct
>
>
;
}
string
:
{
()
:
TypeGuard
<
string
>
;
(
rules
:
Partial
<
Rules
>
)
:
TypeGuard
<
string
>
;
(
rules
:
StringRule
[]
)
:
TypeGuard
<
string
>
;
<
T
extends
string
>
(
matches
:
T
)
:
TypeGuard
<
T
>
;
(
regex
:
RegExp
)
:
TypeGuard
<
string
>
;
}
&
{
optional
:
OptionalizedString
}
symbol
:
()
=>
TypeGuard
<
symbol
>
&
{
optional
:
OptionalizedSymbol
}
useSchema
:
OptionalizedTypeGuardFactory
<
<
T
>
(
schema
:
TypeGuard
<
T
>
)
=>
TypeGuard
<
T
>
>
Settings
Member Visibility
Inherited
External
Theme
OS
Light
Dark
Type Utils
Loading...