jsconfig.json option

strictFunctionTypes

  • Default false
  • Since TypeScript 2.6

When you assign a function to a variable or property with a function type, strictFunctionTypes checks that the function can handle every argument the type allows. A function that only accepts strings cannot stand in for one that may be called with a number; without the option, TypeScript lets it through.

It is part of strict and arrived with TypeScript 2.6.

At a glance

Write Leave it to strict; write "strictFunctionTypes": false only to turn this one check back off
On the command line --strictFunctionTypes
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 When assigning functions, check to ensure parameters and the return values are subtype-compatible.

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(10,1): error TS2322: Type '(text: string) => void' is not assignable to type '(value: string | number) => void'. Types of parameters 'text' and 'value' are incompatible. Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. main.js(10,1): error TS2322: Type '(text: string) => void' is not assignable to type '(value: string | number) => void'. Types of parameters 'text' and 'value' are incompatible. Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. main.js(10,1): error TS2322: Type '(text: string) => void' is not assignable to type '(value: string | number) => void'. Types of parameters 'text' and 'value' are incompatible. Type 'string | number' is not assignable to type 'string'. Type 'number' is not assignable to type 'string'. checked 21 October 2026
/** @type {(value: string | number) => void} */
let log;

/** @param {string} text */
function shout(text) {
  console.log(text.toUpperCase());
}

log = shout;error TS2322: Type '(text: string) => void' is not assignable to type '(value: string | number) => void'.
  Types of parameters 'text' and 'value' are incompatible.
    Type 'string | number' is not assignable to type 'string'.
      Type 'number' is not assignable to type 'string'.
log(42);
strictFunctionTypes on: a string-only function cannot stand in for one that may get a number.
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
/** @type {(value: string | number) => void} */
let log;

/** @param {string} text */
function shout(text) {
  console.log(text.toUpperCase());
}

log = shout;
log(42);
strictFunctionTypes off: the assignment passes, and log(42) would throw.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": [],
    "strictFunctionTypes": false
  },
  "include": [
    "*.js"
  ]
}

Methods are exempt

TypeScript's 2.6 release notes say the stricter rule applies to function types, not to methods. In JSDoc that is the difference between a property holding a function, { log: (value: string) => void }, which is checked strictly, and the method shorthand, { log(value: string): void }, which is not. Prefer the property form in a @typedef when you want the check.

Gotchas

  • The example's log(42) would call toUpperCase on a number at run time; with the option off, nothing reports it.

Sources

Last reviewed 20 October 2026.