TypeScript error

TS2739: An object is missing several required properties

  • Error TS2739
  • Tested with TypeScript 5.9

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

CodeTS2739
MessageType '{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 categoryerror
Listed underTypes 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

address.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: address.js(11,14): error TS2739: Type '{ line1: string; city: string; }' is missing the following properties from type 'Address': postalCode, country 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. address.js(11,14): error TS2739: Type '{ line1: string; city: string; }' is missing the following properties from type 'Address': postalCode, country 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. address.js(11,14): error TS2739: Type '{ line1: string; city: string; }' is missing the following properties from type 'Address': postalCode, country checked 21 October 2026
/**
 * @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, country
An object missing several required properties.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
field.test.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: field.test.js(8,7): error TS2740: Type '{ valueAsNumber: number; }' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 372 more. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. field.test.js(8,7): error TS2740: Type '{ valueAsNumber: number; }' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 376 more. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. field.test.js(8,7): error TS2740: Type '{ valueAsNumber: number; }' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 376 more. checked 21 October 2026
/** @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);
A stand-in object for a DOM element (TS2740 lists the first few and counts the rest).
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.

address.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/**
 * @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);
A complete object, a Partial for a draft, and a cast for a test stand-in.
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

  • Partial makes every property optional, including the ones you always set. For finer control, list the optional ones in the @typedef with 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 unknown first.

Sources

Last reviewed 20 October 2026.