AnyArray |
类型工具库。 |
AnyAsyncFunction |
任意异步函数。 |
AnyFunction |
任意函数。 |
AnyObject |
任意对象。 |
AsyncOrSync |
Useful as a return type in interfaces or abstract classes with missing implementation |
AsyncReturnType |
Unwrap the return type of a function that returns a Promise .There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript. |
Buildable |
Combination of DeepPartial and DeepWritable |
CamelCase |
Convert a string literal to camel-case.This can be useful when, for example, converting some kebab-cased command-line flags or a snake-cased database result. |
Defined |
去除类型 T 中的 undefined。 |
DelimiterCase |
Convert a string literal to a custom string delimiter casing.This can be useful when, for example, converting a camel-cased object property to an oddly cased one. |
ElementOf |
Easily extract the type of a given array’s elements |
FirstParameter |
返回函数 T 第一个参数的类型。 |
FixedLengthArray |
Create a type that represents an array of the given type and length. The array’s length and the Array prototype methods that manipulate its length are excluded in the resulting type.Please participate in [this issue](https://github.com/microsoft/TypeScript/issues/26223) if you want to have a similiar type built into TypeScript.Use-cases: - Declaring fixed-length tuples or arrays with a large number of items. - Creating a range union (for example, 0 | 1 | 2 | 3 | 4 from the keys of such a type) without having to resort to recursive types. - Creating an array of coordinates with a static length, for example, length of 3 for a 3D vector. |
Head |
Functional programming essentials |
IsAny |
判断 T 是否是 any 类型。 |
IsNever |
判断 T 是否是 never 类型。 |
JsonObject |
Matches a JSON object.This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don’t use this as a direct return type as the user would have to double-cast it: jsonObject as unknown as CustomResponse . Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: interface CustomResponse extends JsonObject { … } . |
JsonValue |
Matches any valid JSON value. |
KebabCase |
Convert a string literal to kebab-case.This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag. |
LiteralUnion |
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it’s not needed anymore. |
Merge |
Merge 2 types, properties types from the latter override the ones defined on the former type |
NonNullableDeep |
Like NonNullable but recursive |
NullableDeep |
Recursive nullable |
OmitBy |
Omit all properties of given type in object type |
OmitDeep |
Recursively omit deep properties |
OmitStrict |
Similar to the builtin Omit, but checks the filter strictly. |
OneOrMore |
同 T | T[] 。 |
OptionalKeys |
Gets keys of an object which are optional |
PackageJson |
Type for [npm’s package.json file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn. |
PartialBy |
Mark some properties as optional, leaving others unchanged |
PartialDeep |
Like Partial but recursive |
PascalCase |
Converts a string literal to pascal-case. |
Path |
获取对象的路径。最多支持 7 级路径。 |
PathValue |
获取对象的路径值。最多支持 7 级路径。 |
PickBy |
Pick all properties of given type in object type |
ReadonlyDeep |
Like Readonly but recursive |
ReadonlyKeys |
Gets keys of an object which are readonly |
RequiredBy |
Mark some properties as required, leaving others unchanged |
RequiredDeep |
Like Required but recursive |
RequiredKeys |
Gets keys of an object which are required |
SnakeCase |
Convert a string literal to snake-case.This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name. |
Tail |
|
ValueOf |
Easily extract the type of a given object’s values |
Writable |
Make readonly object writable |
WritableDeep |
Like Writable but recursive |
WritableKeys |
Gets keys of an object which are writable |