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

**Code:** `TS2379/TS2375: exactOptionalPropertyTypes error` · **Category:** TypeScript · **Seen on:** TypeScript

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/typescript/ts2379-argument-not-assignable-exactoptionalpropertytypes)
