Type aliases
Add
Type parameters
CreateNumberObject
Type parameters
Divide
Divide
<A, B>: A extends 0 ? 0 : B extends 0 ? never : LargerThan2<A, B> extends false ? 0 : [A] extends [B] ? 1 : DivideHelper<A, B>Type parameters
DivideHelper
Type parameters
A: number
B: number
C: any[] = []
Equal
Equal
<A, B>: true extends IsAny1<A> ? true extends IsAny1<B> ? true : false : true extends IsAny1<B> ? false : [A] extends [B] ? [B] extends [A] ? true : false : falseType parameters
Filter
Filter
<T, A, TT>: T extends [infer L
, ...infer R
] ? Filter<R, A, [L] extends [A] ? [...TT, L] : TT> : TTType parameters
FindIndex
Find
Index
<T, E, TT>: T extends [infer L
, ...infer R
] ? [E] extends [L] ? IsAny1<L> extends IsAny1<E> ? TT["length"] : FindIndex<R, E, [...TT, 1]> : FindIndex<R, E, [...TT, 1]> : neverType parameters
FirstChar
FirstChar<T>: T extends `${infer P}${any}` ? P : never
Type parameters
FirstItem
FirstItem<T>: T extends [infer F, ...any] ? F : never
Type parameters
Flat
Flat
<T, AT>: T extends [infer L
, ...infer R
] ? L extends any[] ? [...Flat<L>, ...Flat<R>] : [L, ...Flat<R>] : ATType parameters
Flat1
Flat1
<T, AT>: T extends [infer L
, ...infer R
] ? [...L extends any[] ? Flat<L> : [L], ...Flat<R>] : ATType parameters
FlatTupleToString
Flat
Tuple
To
String
<T, Return>: T extends [`${infer L
}`, ...infer R
] ? FlatTupleToString<R, `${L}${Return}`> : ReturnType parameters
T: unknown[]
Return: string = ""
IsAny
IsAny<T>: (string | number | symbol) extends keyof T ? {} extends T ? true : false : false
Type parameters
IsAny1
IsAny1<T>: 0 extends 1 & T ? true : false
Type parameters
IsEmptyType
IsEmptyType<T>: number extends T ? keyof T extends never ? T extends {} ? true : false : false : false
Type parameters
IsFractional
IsFractional<T>: `${T}` extends `${string}.${string}` ? true : false
Type parameters
IsNegative
IsNegative<T>: `${T}` extends `-${string}` ? true : false
Type parameters
IsNever
IsNever<T>: [T] extends [never] ? true : false
Type parameters
IsObject
IsObject<T>: [T] extends [object] ? true : false
Type parameters
IsStringArray
IsStringArray<T>: T extends infer I[] ? I extends string ? T : never : never
Type parameters
LTrim
LTrim
<T>: T extends `${infer L
}${infer R
}` ? [L] extends [" "] ? LTrim<R> : T : TType parameters
LargerThan
Larger
Than
<A, B, TT>: TT["length"] extends A ? false : TT["length"] extends B ? true : LargerThan<A, B, [...TT, 1]>Type parameters
A: number
B: number
TT: number[] = []
LargerThan1
Larger
Than1
<A, B, AO, BO, S, I, F>: S extends Failure ? false : S extends Victory ? true : AO["symbol"] extends 1 ? I extends Failure ? true : I extends Victory ? false : F extends Failure ? true : false : I extends Failure ? false : I extends Victory ? true : F extends Victory ? true : falseType parameters
LargerThan2
Larger
Than2
<A, B, TT>: TT["length"] extends A ? TT["length"] extends B ? true : false : TT["length"] extends B ? true : LargerThan2<A, B, [...TT, 1]>Type parameters
A: number
B: number
TT: number[] = []
LargerThan3
Type parameters
LastChar1
Last
Char1
<T>: T extends `${infer L
}${infer R
}` ? R extends "" ? L : LastChar1<R> : neverType parameters
LastChar2
Last
Char2
<T, Right>: T extends `${infer L
}${infer R
}` ? LastChar2<R, L> : RightType parameters
LastItem
LastItem<T>: T extends [...any, infer R] ? R : never
Type parameters
LengthOfString
Length
Of
String
<T, AT>: T extends `${infer L
}${infer R
}` ? LengthOfString<R, [...AT, L]> : AT["length"]Type parameters
LengthOfTuple
LengthOfTuple<T>: "length" extends keyof T ? T["length"] : 0
Type parameters
Multiply
Type parameters
MultiplyHelper
Multiply
Helper
<A, B, C, D>: C["length"] extends A["length"] ? D["length"] : MultiplyHelper<A, B, [...C, any], [...D, ...B]>Type parameters
A: any[]
B: any[]
C: any[] = []
D: any[] = []
MyConstructorParameters
MyConstructorParameters<T>: T extends abstract new (...args: infer P) => any ? P : never
Type parameters
T: abstract new (...args: any) => any
MyExclude
MyExclude<T, K>: T extends K ? never : T
Type parameters
MyExtract
MyExtract<T, U>: T extends U ? T : never
Type parameters
MyInstanceType
MyInstanceType<T>: T extends abstract new (...args: any) => infer P ? P : T
Type parameters
T: abstract new (...args: any) => any
MyNonNullable
MyNonNullable<T>: T extends null | undefined ? never : T
Type parameters
MyOmit
My
Omit
<T, K>: { [ P in MyExclude<keyof T, K>]: T[P] }Type parameters
T
K: string | number | symbol
MyOmitThisParameter
MyOmitThisParameter<T>: unknown extends ThisParameterType<T> ? T : T extends (...args: infer P) => infer R ? (...args: P) => R : T
Type parameters
MyParameters
MyParameters<T>: T extends (...args: infer U) => unknown ? U : never
Type parameters
MyPartial
MyPartial<T>: { [ P in keyof T]?: T[P] }
Type parameters
MyPick
MyPick<T, K>: { [ P in K]: T[P] }
Type parameters
MyReadonly
MyReadonly<T>: { readonly [ P in keyof T]: T[P] }
Type parameters
MyRecord
MyRecord<K, V>: { [ P in K]: V }
Type parameters
K: string | number | symbol
V
MyRequired
MyRequired<T>: { [ P in keyof T]-?: T[P] }
Type parameters
MyReturnType
MyReturnType<T>: T extends (...args: any) => infer P ? P : never
Type parameters
MyThisParameterType
MyThisParameterType<T>: T extends (this: infer P, ...args: any) => any ? P : unknown
Type parameters
NSymbol
NSymbol: 0 | 1
NumberArrayCompare
Type parameters
A: string[]
B: string[]
CL: boolean
LR = NumberCompare<`${A["length"]}`, `${B["length"]}`>
NumberArrayCompareHandler
Type parameters
NumberCompare
Type parameters
A: string
B: string
T: string[] = []
L = `${T["length"]}`
NumberObjectByN
Number
Object
ByN
<T>: `${T}` extends `${infer _
}${infer I
}` ? NumberObject<1, Split<I>, []> : neverType parameters
NumberObjectByNF
Number
Object
ByNF
<T>: `${T}` extends `${infer _
}${infer I
}.${infer F
}` ? NumberObject<1, Split<I>, Split<F>> : neverType parameters
NumberObjectByP
Type parameters
NumberObjectByPF
Type parameters
NumberToTuple
Number
To
Tuple
<T, R>: R["length"] extends T ? R : NumberToTuple<T, [...R, any]>Type parameters
T: number = 0
R: any[] = []
NumberToTupleLength
Number
To
Tuple
Length
<T, TT>: [T] extends [TT["length"]] ? TT : NumberToTupleLength<T, [...TT, any]>Type parameters
Pop
Pop<T>: T[0]
Type parameters
Push
Push<T, I>: T extends [...infer Rest] ? [...Rest, I] : T
Type parameters
RTrim
RTrim
<T>: T extends `${infer L
}${infer R
}` ? [R] extends [" "] ? L : [RTrim<R>] extends [" "] ? L : `${L}${RTrim<R>}` : TType parameters
Repeat
Repeat
<T, C, AT>: C extends AT["length"] ? AT : Repeat<T, C, [...AT, T]>Type parameters
RepeatString
Type parameters
T: string
C: number
R: T[] = []
RepeatString1
Repeat
String1
<T, C, A>: A["length"] extends C ? "" : `${T}${RepeatString1<T, C, [T, ...A]>}`Type parameters
T: string
C: number
A: string[] = []
ReplaceAll
Replace
All
<S, F, T>: F extends "" ? S : S extends `${infer A
}${F}${infer B
}` ? `${A}${T}${ReplaceAll<B, F, T>}` : SType parameters
S: string
F: string
T: string
ReverseTuple
Reverse
Tuple
<T, AT>: T extends [infer L
, ...infer R
] ? ReverseTuple<R, [L, ...AT]> : ATType parameters
Shift
Shift<T>: T extends [any, ...infer Rest] ? Rest : []
Type parameters
ShiftString
ShiftString<T>: T extends [infer _, ...infer R] ? R : never
Type parameters
Slice
Slice
<A, S, E, C, D, ST, ET>: [0] extends [A["length"]] ? D : [ST["length"]] extends [C["length"]] ? [ET["length"]] extends [C["length"]] ? D : A extends [infer L
, ...infer R
] ? Slice<R, S, E, [...C, 1], [...D, L], [...C, 1], ET> : D : A extends [infer L
, ...infer R
] ? Slice<R, S, E, [...C, 1], D, ST, ET> : DType parameters
A: any[]
S: number = 0
E: number = A["length"]
C: any[] = []
D: any[] = []
SmallerThan
Type parameters
Split
Split
<T, P>: T extends "" ? P : T extends `${infer F
}${infer R
}` ? Split<R, [...P, F]> : neverType parameters
T: string
P: string[] = []
StringToTuple
String
To
Tuple
<T, Tuple>: T extends `${infer L
}${infer R
}` ? StringToTuple<R, [...Tuple, L]> : TupleType parameters
T: string
Tuple: any[] = []
Subtract
Type parameters
Subtract1
Type parameters
SubtractHelper
Subtract
Helper
<A, B, R>: B["length"] extends A["length"] ? R["length"] : SubtractHelper<A, [...B, 1], [...R, 1]>Type parameters
A: any[]
B: any[]
R: any[] = []
SubtractHelper1
Type parameters
SymbolCompare
Type parameters
SymbolCompareResMap
ToNumber
To
Number
<T, TT>: `${TT["length"]}` extends T ? TT["length"] : ToNumber<T, [...TT, any]>Type parameters
Trim
Type parameters
TupleToString
Tuple
To
String
<T>: T extends [infer L
, ...infer R
] ? `${L extends string ? L : ""}${R extends string[] ? TupleToString<R> : ""}` : ""Type parameters
TupleToUnion
Tuple
To
Union
<T, R>: T extends [infer P
, ...infer Q
] ? TupleToUnion<Q, R | P> : RType parameters
TupleToUnion1
TupleToUnion1<T>: T extends [...infer R] ? R[number] : never
Type parameters
TypeTransferValues
TypeTransferValues<T>: [T] extends [object] ? { readonly [ P in keyof T]: T[P] }[keyof T] : T
Type parameters
UnionToIntersection
UnionToIntersection<T>: (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never
Type parameters
UnwrapPromise
UnwrapPromise<T>: T extends Promise<infer P> ? P : never
Type parameters
Add
请实现Add<A, B>计算正整数之和。
type A = Add<1, 2> // 3
type B = Add<0, 0> // 0