Glossary
133 terms from TypeScript Beyond the Basics, in plain words, each with the chapter that teaches it.
#
- .refine
- A Zod method that adds a custom check across several fields, such as "a shipped order must name its carrier". A refined schema can't use `.omit()` or `.pick()`.
- @ts-expect-error
- A comment placed above a line you can't fix yet that tells `tsc` to expect an error there. `tsc` reports it when the line no longer needs it.
- @types packages
- Packages named `@types/<name>` that hold type declarations for plain JavaScript libraries. For example, `@types/node` gives TypeScript the types for Node's built-in features.
A
- AbortSignal.timeout
- A signal you pass to `fetch` that cancels the request if no answer arrives within the given milliseconds. The failure is an Error named `TimeoutError`.
- Alias (paths)
- A short import name for a folder, such as `@lib/*` standing for `./src/lib/*`. It saves you from long paths like `../../lib/money.ts`.
- allowJs
- A tsconfig option that lets `.js` files join a TypeScript project, so `.ts` and `.js` files can import each other. It doesn't type-check the JavaScript by itself.
- any
- A type that turns off type checking for a value. TypeScript accepts anything you do with it, so mistakes only show up when the program runs.
- ApiError
- The client's discriminated union of four failures: `http`, `network`, `timeout` and `invalid`. Callers handle each kind with a `switch` on `kind`.
- as (key renaming)
- In a mapped type, `as` after the key renames each property. For example, `[S in Status as `${S}Count`]` turns `shipped` into `shippedCount`.
- as (type assertion)
- A keyword that tells TypeScript to treat a value as a type you name, without checking it. `res.json() as Order` is only a claim, so wrong data still gets through.
- Assertion function
- A function declared with `asserts` that throws if a check fails. After it returns, TypeScript treats the check as true, so `assert(stock !== null, ...)` makes `stock` a number afterwards.
- assertNever
- A function that takes a `never` value and throws. Calling it in a `switch` default makes the compiler complain if you forget to handle a member of a union.
- Assignable
- A type is assignable to another if a value of the first could be stored in a variable of the second. Conditional types and error messages use this idea.
- Awaited
- A utility type that unwraps a promise to the type `await` would give. `Awaited<Promise<Product[]>>` is `Product[]`.
B
- Build info file
- A file, `tsconfig.tsbuildinfo`, that records what `tsc -b` compiled last time. It lets later builds skip projects that are up to date.
- Build mode
- Running `npx tsc -b` builds each referenced project before the projects that depend on it. Plain `tsc` ignores project references.
- Bundler
- A tool, such as Vite, that combines many source files into a few files for the browser. Apps built by a bundler can use options like `"moduleResolution": "bundler"` and `paths` aliases.
C
- checkJs
- A tsconfig option that makes TypeScript type-check `.js` files too. Adding `// @ts-check` as a file's first line checks just that file.
- composite
- A tsconfig setting that a project must have before others can reference it. It turns on `declaration` and lets `tsc` track the project's files between builds.
- Conditional type
- A type of the form `T extends U ? X : Y` that picks one of two types. It gives `X` if `T` is assignable to `U`, and `Y` otherwise.
- Constraint
- `extends` after a type parameter limits which types are allowed. `T extends { sku: string }` accepts any type that has a string `sku`.
- Content-Type header
- An HTTP header that tells the receiver what format a request or response body is in. When posting JSON, a client sends `"Content-Type": "application/json"`.
D
- declaration
- A tsconfig option that makes `tsc` write a `.d.ts` file next to each `.js` file it outputs. You need it when other packages will use your compiled code.
- Declaration file
- A `.d.ts` file holds types but no code. It describes JavaScript, such as a plain package or a script the browser loads, to TypeScript.
- Declaration merging
- Two `interface` declarations with the same name combine into one that has the properties of both. This lets you add to types you don't own.
- declare
- A keyword that says "this exists when the program runs, and here is its type". It has no body or value, and TypeScript can't check that the promise is true.
- declare global
- A declaration used inside a module to add names to the global scope, which is otherwise not possible from a module. For example, `declare global { var KC_VERSION: string }` makes `KC_VERSION` available in every file.
- Default type parameter
- A type parameter can have a default that is used when no type is given. In `Result<T, E = string>`, `Result<Product>` means `Result<Product, string>`.
- DefinitelyTyped
- A volunteer project that publishes types for JavaScript packages as `@types/<name>`. TypeScript looks there when a package ships no types of its own.
- Deriving schemas
- Building new Zod object schemas from existing ones with methods like `.omit()`, `.pick()`, `.partial()` and `.extend()`, much like TypeScript's utility types. Schemas that have a `.refine()` check can't use `.omit()` or `.pick()`, so you derive from the unrefined base schema instead.
- Discriminated union
- A union of object types that share a property, such as `ok: true` or `ok: false`, which tells you which member you have. Checking that property narrows the type.
- Distributive
- A conditional type applied to a union checks each member on its own and joins the answers. That's how `Exclude` removes some members and keeps the rest.
E
- Environment variable
- A named text setting that the system gives a program when it starts. Node exposes them in `process.env`, where each is a string or `undefined`.
- erasableSyntaxOnly
- A tsconfig option that rejects TypeScript syntax Node can't simply strip out, such as enums. With it on, any file can run directly with `node`.
- ESLint
- The most widely used linter for JavaScript and TypeScript. It reads its settings from `eslint.config.js`.
- exactOptionalPropertyTypes
- A tsconfig option under which an optional property `carrier?: string` means "missing, or a string", but not `undefined`. Add `| undefined` to allow that.
- Exclude
- A utility type that removes from a union the members that match another type. `Exclude<Status, "shipped" | "cancelled">` leaves `"pending" | "paid"`.
- export declare
- The form `tsc` writes in a generated `.d.ts` file for each exported item, such as `export declare function formatCents(cents: number): string;`. It states that the item exists in the matching `.js` file and gives its type, with no function bodies or values.
- exports (package.json)
- The package.json field that lists what other code may import from a package. A `"types"` entry inside it points TypeScript to the package's `.d.ts` file.
- extends (tsconfig)
- A tsconfig setting that starts one config from another file's options. The project lists only what differs, and its own values win.
- Extract
- A utility type that keeps only the members of a union that match another type. It's the opposite of `Exclude`.
F
- fetch
- A built-in function that sends an HTTP request and returns a `Promise<Response>`. It doesn't throw for 404 or 400 replies, so you must check `res.ok`.
- Floating promise
- A promise that nothing waits for, usually because `await` was forgotten. If it fails, nobody hears about it; typescript-eslint's `no-floating-promises` rule catches it.
G
- Generic
- Code that has type parameters, so one function, interface or class works for any type and keeps it. Priya's `first` function can return a `Product` or a `string` depending on the list.
- Git
- A version control tool that tracks the history of changes in a project folder, which is then called a repository.
- globalThis
- The global object in both Node and browsers. Only `var` declarations become its properties.
H
- HTTP method
- The verb in an HTTP request that says what to do. `GET` reads, `POST` creates (like `createOrder`) and `PATCH` changes part of something (like `updateOrder`).
- HTTP status codes
- Numbers in a server's reply that say how the request went: 200 OK (success), 400 bad request, 404 not found. `res.ok` is true only for 200 to 299.
- HttpError
- A custom class that extends `Error` and adds the HTTP `status` and an error `code`. The `request` helper throws it when the server answers with an error status such as 404.
I
- import type
- An import that is removed completely when the code is compiled. Types must be imported this way when Node strips types and `verbatimModuleSyntax` is on.
- import() type (JSDoc)
- In a JSDoc comment, `import("./types.js").Cafe` refers to a type exported from another file. It's needed because `.js` files can't contain `import type`.
- include and exclude
- tsconfig options listing which files belong to the project. By default, all files do.
- Indexed access type
- `T["key"]` is the type of one property of `T`. `Order["status"]` is the `Status` union.
- infer
- A keyword used inside a conditional type to name a part of a type for TypeScript to work out. `ItemOf<T>` uses `infer E` to capture an array's item type.
- Infer (type inference)
- TypeScript working out a type itself, such as filling in `T` from a function's arguments. You can hover in VS Code to see what it chose.
- Issue (Zod)
- One problem a Zod schema found in the data, with a `message` and a `path` to the bad value. A `ZodError` holds a list of them.
J
- JSDoc
- Comments that start with `/**` and hold tags, so TypeScript can read types in plain JavaScript files. They let you add types without renaming files to `.ts`.
- JSDoc tag
- A word starting with `@` inside a JSDoc comment. `@param {number} cents` says the parameter `cents` is a number.
- JSON
- A text format for data. `JSON.parse` turns JSON text into a value, and `JSON.stringify` turns a value into JSON text to send.
K
- keyof
- An operator that gives the union of a type's property names as literal types. For `Product`, `keyof Product` is `"sku" | "name" | ...`.
L
- Leaf file
- A file that imports none of your own files. Convert leaf files to TypeScript first, since doing so can't break anything they depend on.
- lib
- A tsconfig option choosing which built-in declarations load, such as the JavaScript or browser (`"dom"`) types. It defaults from `target`.
- Linter
- A tool that reads your code and reports risky patterns, such as ESLint with typescript-eslint. It catches things the compiler allows.
M
- Mapped type
- A type like `{ [K in keyof T]: ... }` that builds an object type with one property for each key in a union. `Partial` and `Readonly` are mapped types.
- module and moduleResolution
- tsconfig options describing how modules work and how imports are found. Use `"nodenext"` for code Node runs, and `"preserve"` with `"bundler"` for bundled apps.
- Module augmentation
- Adding to a package's types with `declare module "name"` inside a file that is a module. Combined with declaration merging, it let Alex add `phone` to `Shipment`.
- Monorepo
- A single repository that holds several packages, each with its own package.json, tsconfig.json and src folder. Kettle & Crane's `shared`, `api` and `shop` live in one.
N
- Narrowing
- Making TypeScript's idea of a value's type more specific after a check, such as `typeof`, `in`, `===` or a type guard.
- Network error
- A failed request that got no answer at all. In Node it appears as a `TypeError` saying "fetch failed".
- never
- A type with no values. In a union it disappears, and `Result<never>` can only be the error kind, so it fits any `Result<T>`.
- node --watch
- A Node.js flag that reruns your program whenever you save a file it uses. It is handy for development, for example in a `dev` npm script like `node --watch src/main.ts`.
- Node.js
- The program that runs JavaScript outside the browser. Node 22 can run a `.ts` file directly by deleting its types, without checking them.
- noEmitOnError
- A tsconfig option that stops `tsc` writing any files while there are type errors.
- noImplicitAny
- A strict-mode check that reports parameters or values whose type TypeScript can't work out and would silently make `any`. It's often switched off temporarily during a migration.
- NonNullable
- A utility type that removes `null` and `undefined` from a type or union.
- noUncheckedIndexedAccess
- A strict-style option that adds `undefined` to values read by index, such as `PRODUCTS[0]`, so you must check them before use.
- noUnusedLocals
- Options that report variables, imports or parameters you never use. Starting a parameter name with `_` allows it under `noUnusedParameters`.
- npm
- Node's package manager. `npm install` downloads dependencies, and `-D` records a tool such as TypeScript in `devDependencies`, used only while developing.
- npm scripts
- Named commands in package.json's `scripts` field, such as `check`, `build` and `lint`. You run them with `npm run <name>`, and `npm start` is short for `npm run start`.
- npm workspaces
- An npm feature where one `npm install` sets up every package in a monorepo and links them together. `npm run build -w @kc/api` runs one workspace's script.
O
- Overloads
- One function declared with several call shapes, each with its own return type. Callers see the overload signatures, and a hidden implementation signature holds the body.
P
- Parameters
- A utility type that gives a tuple of a function's parameter types. You pass it the function's type, using `typeof`.
- parse and safeParse
- `.parse(data)` returns checked data or throws a `ZodError`. `.safeParse(data)` never throws and returns `{ success: true, data }` or `{ success: false, error }`.
- Partial, Required and Readonly
- Utility types that change every property: `Partial` makes all optional, `Required` makes all required, and `Readonly` makes all read-only. `Readonly` is shallow, so nested arrays can still change.
- paths
- A tsconfig option that maps short alias names to folders. It only tells `tsc` where to look, so Node can't run the aliased imports without a bundler.
- Pick and Omit
- `Pick` keeps only the named properties of a type, and `Omit` keeps all the others. `NewOrder` is an `Order` with the four server-filled fields omitted.
- private
- A class keyword meaning a property can only be used inside the class. `Cache<T>` keeps its `items` map private.
- Project references
- A tsconfig `"references"` list naming projects that must be built first. It tells `tsc -b` that `api` can't build until `shared` has.
- Promise.all
- Waits for several promises at once. Given promises of different types, TypeScript infers a tuple such as `[Cafe[], Order[]]`.
R
- Repository
- A project folder whose history of changes is tracked by Git.
- RequestInit
- The type of `fetch`'s second argument. It sets the `method`, `headers` and `body` of the request.
- Response
- What `fetch` returns: `status` is the code, `ok` is true for 200 to 299, and `json()` reads and parses the body. `res.json()` returns `any`, so treat it as `unknown`.
- Result type
- A discriminated union holding either a value or an error, so the caller must check which it got. It puts failure into the return type instead of throwing.
- ReturnType
- A utility type that gives the type a function returns. For an `async` function it gives a promise, which `Awaited` can unwrap.
- rewriteRelativeImportExtensions
- A tsconfig option that lets you write `"./types.ts"` in imports while `tsc` changes them to `.js` in the output. Both Node running source and Node running `dist` then work.
- rootDir and outDir
- tsconfig options for where your source files are and where compiled output goes.
- Runtime validation
- Checking data with code while the program runs. Types are erased before then, so only code can check what actually arrives, such as KC-2110's wrong status.
S
- satisfies
- An operator that checks a value against a type but keeps the more precise type TypeScript inferred. It also catches missing keys, such as a status without a label.
- Schema
- A Zod object that describes what data should look like and checks it at run time. The same schema also gives the TypeScript type.
- Scoped name
- A package name such as `@kc/shared`, where `@kc/` groups the team's packages and keeps names from clashing with public ones.
- Shorthand ambient module
- A bare `declare module "x";` makes every import from that package `any`, which turns checking off. Describing the package with a full `declare module` block is better.
- Single source of truth
- One definition that everything else derives from. With Zod, one schema gives both the checks and the types, so they can't disagree.
- skipLibCheck
- A tsconfig option that skips type-checking `.d.ts` files. That check is slow and reports mistakes you can't fix; your own code is still checked against them.
- Solution config
- A root tsconfig with `"files": []` that compiles nothing itself and only lists the packages in `references`.
- sourceMap
- A tsconfig option that writes `.js.map` files so errors and debuggers point back to your `.ts` lines.
- strict
- A `tsconfig.json` option that turns on TypeScript's family of stricter type checks together. It is commonly used alongside extra options such as `noUncheckedIndexedAccess`.
- Symlink
- A shortcut to a real folder or file. npm uses one so `node_modules/@kc/shared` points at `packages/shared`, and edits there show up at once.
T
- target
- A tsconfig option for which JavaScript version `tsc` writes, such as `"es2024"`.
- Template literal type
- A string type built like a template string. Given a union, it makes one string per member, so `${Status}Count` gives `"pendingCount" | "paidCount" | ...`.
- Timeout
- Giving up on a request that takes too long. `AbortSignal.timeout` cancels it and raises an Error named `TimeoutError`.
- Top-level await
- Using `await` directly in a module, outside any `async` function. It lets a script wait for a promise, such as a `fetch` call, without wrapping the code in a function.
- tsc --init
- A command that writes a commented starter tsconfig.json. TypeScript 7's version already turns on several strict options.
- tsc --noEmit
- Runs the type check without writing any output files. It's fast enough to run after every change.
- tsc --showConfig
- A command that prints the combined result of a tsconfig and everything it extends.
- Tuple
- An array type with a fixed length and a known type at each position, such as `[string, number]`.
- Type argument
- The actual type written at a call or use of a generic, such as `first<string>([])` or `new Map<string, number>()`.
- Type parameter
- A name in angle brackets, such as `T`, that stands for a type to be filled in at each call. `first<T>` works for products, strings or orders.
- Type predicate
- A return type of the form `value is Type`. When the function returns `true`, TypeScript narrows the argument to that type.
- Type stripping
- Node 22 running a `.ts` file by deleting its types, without checking them. That's why type imports must be marked `import type`, and why you still run `tsc` to check types.
- typeof (type position)
- In a type, `typeof x` takes the type of a value. `ReturnType` needs it because it wants a function's type, not the function itself.
- types (tsconfig)
- A tsconfig option choosing which `@types` packages load globally. Setting `["node"]` fixes "Cannot find name 'process'".
- typescript-eslint
- An ESLint add-on that provides rules which use TypeScript's type information, such as `no-floating-promises`, to catch mistakes the compiler allows. As of October 2026 it needs TypeScript 6 installed alongside TypeScript 7.
U
- unknown
- A type for a value you know nothing about. Unlike `any`, you must narrow it before using it, so it's the honest type for parsed JSON.
- URLSearchParams
- A built-in class that builds URL query text such as `cafe=bloom` and escapes unsafe characters.
- User-defined type guard
- A function that returns a type predicate, so TypeScript narrows a value after the check. `isCarrier` narrows a string to `Carrier`, but TypeScript trusts a guard without checking it.
- Utility type
- A built-in generic type that makes new types from old ones, such as `Partial<Order>`. They can be nested and are read from the inside out.
V
- verbatimModuleSyntax
- A tsconfig option that makes `tsc` insist on `import type` for imports that are only types. It catches the error Node would otherwise hit when stripping types.
- Vitest
- A fast testing tool for JavaScript and TypeScript projects, used to write and run automated tests such as those for an API client or a web shop.
Z
- z.coerce
- A Zod schema that converts the value first (for example with `Number()`) and then checks it. `"3"` becomes `3`, and `"abc"` fails; it suits text from forms and environment variables.
- z.infer
- Works out the TypeScript type that a Zod schema accepts, so you don't write the type twice. A value and a type may share a name, such as `Product`.
- z.prettifyError
- A Zod function that formats a `ZodError`'s issues as readable text for people, naming each bad field.
- z.ZodType
- The type of any Zod schema whose parsed result is a `T`. A function taking `z.ZodType<T>` infers `T` from the schema you pass and returns data that's really a `T`.
- Zod
- A runtime validation library that checks data against schemas and gives the matching TypeScript types. It's a normal dependency because it runs inside your finished program.