English | 简体中文
A collection of TypeScript utility types
- Version >= 5.0.0
npm install @13onthecode/types --save-dev
import type { MergeObject } from '@13onthecode/types'
type Foo = {
foo: 'foo'
other: {
foo: 'foo'
}
}
type Bar = {
bar: 'bar'
other: {
bar: 'bar'
}
}
type Merged = MergeObject<Foo, Bar>
// => {
// foo: "foo"
// bar: "bar"
// other: {
// bar: 'bar'
// }
// }
type DeepMerged = MergeObject<Foo, Bar, { mode: 'deep' }>
// => {
// foo: "foo"
// bar: "bar"
// other: {
// foo: "foo"
// bar: "bar"
// }
// }
EmptyArray
EmptyMap
EmptyObject
EmptyRecord
EmptySet
EmptyTuple
Primitive
TypedArray
UnknownArray
UnknownAsyncFunction
UnknownFunction
UnknownMap
UnknownObject
UnknownRecord
UnknownSet
UnknownTuple
IsAny
IsArray
IsAsyncFunction
IsBigint
IsBigintLiteral
IsBoolean
IsBooleanLiteral
IsContains
IsEmptyArray
IsEmptyMap
IsEmptyObject
IsEmptyRecord
IsEmptySet
IsEmptyString
IsEqual
IsExtends
IsFalse
IsFunction
IsLiteral
IsMap
IsNever
IsNonNullable
IsNull
IsNullable
IsNumber
IsNumberLiteral
IsObject
IsPrimitive
IsSet
IsString
IsStringLiteral
IsSymbol
IsSymbolLiteral
IsTrue
IsTuple
IsUndefined
IsUnion
IsUnknown
IsVariadicTuple
Entries
GetKeys
GetOptional
GetReadonly
GetRequired
GetValues
HasIntersection
OmitByValues
OmitIndexSignature
PickByValues
PickIndexSignature
Prettify
SetOptional
SetReadonly
SetRequired
ToArray
ToNumber
ToPrimitive
ToTuple
ToUnion
UnionToIntersection
Writable
MIT License © 2023-PRESENT 13OnTheCode