Home › JavaScript

TS2353: Object literal may only specify known properties (TypeScript) — how to fix

error TS2353: Object literal may only specify known properties, and 'colour' does not exist in type 'Options'.

Quick fix: Fix the property name, or add the property to the type (interface Options { colour?: string }). If the type comes from a library, check the docs for the correct option name or upgrade the @types package. Use satisfies to keep checking while inferring the literal type.

What it means

TypeScript normally allows extra properties on objects (structural typing). The exception is a fresh object literal written directly where a type is expected. There, any property the type doesn't know about is flagged, because it's almost always a mistake:

interface Options { color?: string; size?: number }

const o: Options = { colour: "red" };
// TS2353: 'colour' does not exist in type 'Options'

Cause 1: typo or wrong property name

The most common case. Hover the target type in your editor and compare the names: colour vs color, className vs class, onClick vs onclick, headers vs header.

With libraries this often means an option was renamed between versions. Check the changelog for the version you have installed (npm ls <package>).

Cause 2: the type is missing the property

If the property is valid, add it to the type:

interface Options {
  color?: string;
  size?: number;
  debug?: boolean;
}

For objects that legitimately carry arbitrary keys, add an index signature:

interface Options {
  color?: string;
  [key: string]: unknown;
}

Cause 3: union or discriminated union

With a union target, the literal must match one member:

type Shape =
  | { kind: "circle"; radius: number }
  | { kind: "square"; size: number };

const s: Shape = { kind: "circle", size: 3 }; // 'size' does not exist

Use the property that belongs to that kind.

Cause 4: ORM / query builder argument (Prisma, etc.)

prisma.user.findMany({ where: { emial: "a@b.c" } }); // TS2353

The generated types list every allowed field. After changing the schema, regenerate the client so the types include the new field:

npx prisma generate

Cause 5: you want inference plus checking

Annotating with : Type widens the variable. satisfies (TypeScript 4.9+) checks excess properties but keeps the precise literal type:

const config = {
  color: "red",
  size: 2,
} satisfies Options;

Assigning through an intermediate variable or a cast silences the error, but the extra property will still be ignored at runtime by whatever consumes the type:

const raw = { colour: "red" };
const o: Options = raw; // no error, but colour is still wrong

Only do this if the extra property is intentional.

Last updated 2026-12-01.