error TS2739: Type '{ line1: string; city: string; }' is missing the following properties from type 'Address': postalCode, country is reported when an object lacks two or more properties its type requires. With one missing property the message is TS2741 instead; when more than five are missing it becomes TS2740, which names the first four and counts the others (and 372 more).
TS2740 is what you see when a small object stands in for a large built-in type, such as a fake HTMLInputElement in a test. The DOM types declare hundreds of properties and the checker expects every one of them.
At a glance
| Code | TS2739 |
|---|---|
| Message | Type '{0}' is missing the following properties from type '{1}': {2} |
Also on this page: TS2740 | Type '{0}' is missing the following properties from type '{1}': {2}, and {3} more. |
| TypeScript's category | error |
| Listed under | Types do not match |
| Turned on by | No option: every checked file reports it |
| In .js files | Reported when the file is checked: checkJs in jsconfig.json, or // @ts-check at the top of the file |
The messages are TypeScript's own text from its diagnostic messages file (Apache-2.0); {0}, {1}, {2} and {3} are filled in by tsc for each error.
What it looks like
/**
* @typedef {object} Address
* @property {string} line1
* @property {string} city
* @property {string} postalCode
* @property {string} country
*/
/** @type {Address} */
export const shipTo = { line1: "1 Main Street", city: "Springfield" };error TS2739: Type '{ line1: string; city: string; }' is missing the following properties from type 'Address': postalCode, countryjsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} /** @param {HTMLInputElement} field */
export function readQuantity(field) {
return field.valueAsNumber || 1;
}
/** @type {HTMLInputElement} */
const fakeField = { valueAsNumber: 3 };error TS2740: Type '{ valueAsNumber: number; }' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 372 more.
readQuantity(fakeField);jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} What causes it
- The object is incomplete for the type it is given: a draft, a partly loaded record, a form being filled in.
- A stand-in object (a test double, a mock event) is typed as the full built-in type it imitates.
How to fix it
Complete the object, or say it is partial
Add the missing properties when the object is meant to be whole. When it is legitimately incomplete for a while, type it as Partial<Address>, which makes every property optional, and check the fields before using it as an Address.
/**
* @typedef {object} Address
* @property {string} line1
* @property {string} city
* @property {string} postalCode
* @property {string} country
*/
/** @type {Address} */
export const shipTo = { line1: "1 Main Street", city: "Springfield", postalCode: "12345", country: "US" };
/** @type {Partial<Address>} */
export const draft = { line1: "1 Main Street", city: "Springfield" };
/** @param {HTMLInputElement} field */
export function readQuantity(field) {
return field.valueAsNumber || 1;
}
const fakeField = /** @type {HTMLInputElement} */ ({ valueAsNumber: 3 });
readQuantity(fakeField);jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} Cast a stand-in object
For a test double, a JSDoc cast says "treat this as the full type": /** @type {HTMLInputElement} */ ({ valueAsNumber: 3 }), with the parentheses the cast needs. A cast is accepted when one type could be a subset of the other, so a smaller object passes; it does not check that the code under test only reads the properties you supplied.
Gotchas
Partialmakes every property optional, including the ones you always set. For finer control, list the optional ones in the@typedefwith brackets.- A cast between types that do not overlap at all (an object with none of the target's properties) is still an error; the checker then suggests casting through
unknownfirst.
Sources
- Utility Types: Partial · TypeScript handbook
- JSDoc Reference: Casts · TypeScript handbook
- diagnosticMessages.json (TypeScript 5.9.3) · TypeScript on GitHub
Last reviewed 20 October 2026.