jsconfig.json option

strictPropertyInitialization

  • Default false
  • Since TypeScript 2.7

A class field declared with a type, such as /** @type {string} */ owner;, promises that every instance has a string there. strictPropertyInitialization checks the promise: the field needs an initializer (owner = "";) or an assignment in the constructor. If it has neither, it starts out undefined, and TypeScript reports TS2564.

It is part of strict, arrived with TypeScript 2.7, and needs strictNullChecks, which strict also turns on.

At a glance

Write Leave it to strict; write "strictPropertyInitialization": false only to turn this one check back off
On the command line --strictPropertyInitialization
Type boolean
Default in TypeScript 5.9 false (on when strict is on)
Default from TypeScript 6.0 true, through strict (TypeScript 6.0)
TypeScript's description Check for class properties that are declared but not set in the constructor.

The description is quoted from TypeScript's own option list (Apache-2.0); see the notices.

Examples

main.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: main.js(4,3): error TS2564: Property 'owner' has no initializer and is not definitely assigned in the constructor. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. main.js(4,3): error TS2564: Property 'owner' has no initializer and is not definitely assigned in the constructor. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. main.js(4,3): error TS2564: Property 'owner' has no initializer and is not definitely assigned in the constructor. checked 21 October 2026
export class Account {
  /** @type {string} */
  owner;error TS2564: Property 'owner' has no initializer and is not definitely assigned in the constructor.

  /** @type {number} */
  balance;

  constructor() {
    this.balance = 0;
  }
}
strictPropertyInitialization on: a typed field the constructor never sets.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": [
    "*.js"
  ]
}
main.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
export class Account {
  /** @type {string} */
  owner;

  /** @type {number} */
  balance;

  constructor() {
    this.balance = 0;
  }
}
strictPropertyInitialization off: the field is a string that starts out undefined.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": [],
    "strictPropertyInitialization": false
  },
  "include": [
    "*.js"
  ]
}

Three ways to fix it

In a .js file:

  • give the field a value: owner = "";
  • assign it in the constructor, as the example does for balance
  • say it may be missing: /** @type {string | undefined} */ owner;

Properties set only in the constructor

Many JavaScript classes never declare fields; they assign this.owner = owner in the constructor, and TypeScript infers the property from that. Such properties are always set, so this check has nothing to report about them.

Gotchas

  • TypeScript files can write owner!: string to say "set elsewhere". JavaScript has no such syntax; use one of the fixes above.
  • Without strictNullChecks the option is a config error.

Sources

Last reviewed 20 October 2026.