TS2379/TS2375: exactOptionalPropertyTypes error TypeScript Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

TypeScript: error TS2379: Argument of type '{ name: string; age: undefined; }' is not assignable to parameter of type 'User' with 'exactOptionalPropertyTypes: true'

With exactOptionalPropertyTypes, an optional property (age?: number) can be omitted but not explicitly set to undefined.

Exact message you may see error TS2379: Argument of type is not assignable to parameter of type with 'exactOptionalPropertyTypes: true'error TS2375: Type is not assignable to type with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's propertieswith 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the targetTS2379 TS2375 exactOptionalPropertyTypes
Seen on: TypeScript

Meaning

Either omit the property, or declare it as age?: number | undefined, or turn the option off. The flag distinguishes "missing" from "undefined". Common when spreading objects with undefined values or passing optional props through.

Common causes

  • Passing undefined explicitly to an optional prop
  • Spread of objects with undefined values
  • Library types not written for the flag
  • Conditional object building
  • Default parameters

⚡ Quick fix

  1. Declare prop?: T | undefined
  2. Build objects without undefined keys (...(x ? { x } : {}))
  3. Disable exactOptionalPropertyTypes if not needed

Detailed fix by platform

TypeScript

  1. interface User { name: string; age?: number | undefined }

How to diagnose

  1. Flag — Enabled?
  2. Value — Explicit undefined?
  3. Type — Allows undefined?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Cannot find module './App.vue' or its corresponding type declarations — TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations. (Vue)Cannot find module '.…TS1005: ';' expected / ',' expected (syntax error) — TypeScript: error TS1005: ';' expected. (TypeScript)TS1005: ';' expected …TS1128: Declaration or statement expected — TypeScript: error TS1128: Declaration or statement expected. (TypeScript)TS1128: Declaration o…TS1192: Module has no default export — TypeScript: error TS1192: Module '"./utils"' has no default export. (TypeScript)TS1192: Module has no…TS2322 — TS2322: Type 'X' is not assignable to type 'Y' (TypeScript)TS2322TS2353: Object literal may only specify known properties — TypeScript: error TS2353: Object literal may only specify known properties, and 'nmae' does not exist in type 'User' (TypeScript)TS2353: Object litera…TS2740: Type is missing the following properties — TypeScript: error TS2740: Type '{ name: string; }' is missing the following properties from type 'User': id, email (TypeScript)TS2740: Type is missi…TS6133: 'x' is declared but its value is never read — TypeScript: error TS6133: 'x' is declared but its value is never read. (TypeScript)TS6133: 'x' is declar…TS2379/TS…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.