SyntaxStudy
Sign Up
Home TypeScript Reference

TypeScript Reference

12 entries — click any item for full details and examples

Primitive Types

Name Description
string / number / boolean TypeScript 1.0 TypeScript's three basic primitive types. Type annotations are optional when the value is obvious (type inference).
any / unknown / never / void Special types: any disables type checking; unknown is type-safe any; never for functions that never return; void for no...

Complex Types

Name Description
interface Defines the shape of an object. Supports optional properties (?), readonly, and extension (extends).
type alias Creates a named type alias. Unlike interfaces, can alias primitives, unions, tuples, and mapped types.
Generics Generics create reusable components that work with multiple types while maintaining type safety.
Union & Intersection types Union (|) means "one of these types"; Intersection (&) means "all of these types combined".
Enums Enums define a set of named constants. Numeric enums auto-increment; string enums are explicit.

Utility Types

Name Description
Partial<T> / Required<T> Partial makes all properties optional; Required makes all properties required. Both create new types.
Pick<T, K> / Omit<T, K> Pick selects a subset of properties; Omit excludes specified properties. Both create new types.
Record<K, V> / Readonly<T> Record creates a type with specific keys and value types; Readonly makes all properties immutable.

Type Operators

Name Description
typeof / keyof / typeof keyof produces a union of a type's property names; typeof gets the type of a variable.
Type Guards / narrowing Type guards narrow the type within a conditional block, making TypeScript aware of the specific type.