• Error
  • Reported by the type checker

TS18050

The value '{0}' cannot be used here.

The literal `null` or `undefined` is used where it can never work, such as `null.x` or `null + 1`.

What it means

The value null (or undefined) is written directly in a position where it can only fail or make no sense: accessing a property on it, calling it, or using it as an arithmetic operand. The message names the value.

Example

index.ts
export const n = null + 1;
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(1,18): error TS18050: The value 'null' cannot be used here.

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

  • Replace the literal with the value you meant, or remove the expression.