Loading...
Preparing your coding drills
Comprehensive reference for 37 TypeScript methods across 9 categories.
Partial<T>
Constructs a type with all properties of Type set to optional. Useful for update operations where you only need to specify changed fields.
Required<T>
Constructs a type with all properties of Type set to required. The opposite of Partial.
Readonly<T>
Constructs a type with all properties of Type set to readonly. Prevents reassignment of properties.
Record<K, T>
Constructs an object type whose property keys are Keys and whose property values are Type. Useful for mapping one type to another.
Pick<T, K>
Constructs a type by picking the set of properties Keys from Type.
Omit<T, K>
Constructs a type by picking all properties from Type and then removing Keys.
Exclude<T, U>
Constructs a type by excluding from UnionType all union members that are assignable to ExcludedMembers.
Extract<T, U>
Constructs a type by extracting from Type all union members that are assignable to Union.
NonNullable<T>
Constructs a type by excluding null and undefined from Type.
ReturnType<T>
Constructs a type consisting of the return type of function Type.
Parameters<T>
Constructs a tuple type from the types used in the parameters of a function type.
Awaited<T>
Recursively unwraps the "awaited type" of a type. Useful for modeling await in async functions or Promise.all.
InstanceType<T>
Constructs a type consisting of the instance type of a constructor function type.
ConstructorParameters<T>
Constructs a tuple type from the types of a constructor function parameter types.
ThisType<T>
Marks the contextual this type in an object literal. Useful for defining methods that have access to a specific this type.
typeof
Captures the type of a value or variable. Useful for inferring types from existing values.
keyof
Produces a union of the property names (keys) of an object type.
is (type predicate)
Defines a user-defined type guard. When the function returns true, TypeScript narrows the type.
asserts (assertion function)
Defines an assertion function that throws if condition is false. TypeScript narrows the type after the assertion.
as const
Creates a readonly type with literal types instead of general types. Makes arrays become readonly tuples and objects deeply readonly.
satisfies
Validates that an expression is assignable to a type without changing the inferred type. Preserves literal types while ensuring type safety.
Mapped Types
Creates a new type by transforming properties of an existing type. Foundation for utility types like Partial and Readonly.
Conditional Types
Creates a type that depends on a condition. If T extends U, the type is X, otherwise Y.
infer
Declares a type variable within a conditional type that can be referenced in the true branch.
Template Literal Types
Creates string literal types by interpolating other types. Enables powerful string manipulation at the type level.
Uppercase<S>
Converts each character in the string type to uppercase.
Lowercase<S>
Converts each character in the string type to lowercase.
Capitalize<S>
Converts the first character of the string type to uppercase.
Uncapitalize<S>
Converts the first character of the string type to lowercase.
Array<T>
Represents an array of elements of type T. Both Array<T> and T[] syntaxes are equivalent.
ReadonlyArray<T>
Represents an immutable array. Prevents push, pop, and direct element assignment.
Tuple Types
Fixed-length array where each element can have a different type. Position determines the type.
Index Signatures
Describes objects that can have any number of properties with the specified key and value types.
PropertyKey
Built-in type representing all possible property key types in JavaScript.
Function Overloads
Allows a function to have multiple type signatures. TypeScript selects the appropriate signature based on arguments.
Generic Functions
Functions that work with multiple types while maintaining type relationships. Type parameters are inferred from arguments.
Generic Constraints
Restricts generic type parameters to types that satisfy certain requirements.