• Error
  • Reported by the type checker

TS2314

Generic type '{0}' requires {1} type argument(s).

A generic type is used without the type arguments it requires, like `Map` instead of `Map<K, V>`. Add them.

What it means

A generic type whose type parameters have no defaults needs type arguments every time it is written as a type. The message says how many.

Example

index.ts
type Box<T> = { value: T };

export const b: Box = { value: 1 };
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(3,17): error TS2314: Generic type 'Box<T>' requires 1 type argument(s).

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.

How to fix

  • Add the type arguments: Box<number>.
  • If most uses want the same type, give the parameter a default: type Box<T = unknown>.