TypeScript error

TS2583: Map, Set or Promise is missing because the target is old

  • Error TS2583
  • Tested with TypeScript 5.9

error TS2583: Cannot find name 'Map'. Do you need to change your target library? and its companion TS2585 ('Promise' only refers to a type, but is being used as a value here.) are reported when the libraries the checker loads predate ES2015. Without Map, Set, Promise and Symbol as values, everyday code fails.

The cause is nearly always a jsconfig.json without target. TypeScript 5.9 then assumes es5 and loads the ES5 library. The message suggests changing lib, but lib follows target by default, so setting target is the simpler fix.

At a glance

CodeTS2583
MessageCannot find name '{0}'. Do you need to change your target library? Try changing the 'lib' compiler option to '{1}' or later.
Also on this page: TS2585 '{0}' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
TypeScript's categoryerror
Listed underUnknown names and members
Depends on target, lib
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} and {1} are filled in by tsc for each error.

What it looks like

cache.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: cache.js(2,20): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later. cache.js(5,15): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. 6.0.3 : differs, see why TypeScript 6.0.3, run 21 October 2026: differs from 5.9.3. No errors. 7.0.2 : differs, see why TypeScript 7.0.2, run 21 October 2026: differs from 5.9.3. No errors. checked 21 October 2026
const prices = new Map();error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.

const ready = Promise.resolve(prices);error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.

module.exports = { prices, ready };
No target in jsconfig.json, so the checker assumes ES5.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "types": []
  },
  "include": ["*.js"]
}

What causes it

  • No target in the config (the default is es5 in TypeScript 5.9), and no module such as nodenext that implies a newer one.
  • A lib list that names an old ECMAScript year.

How to fix it

Set target to the JavaScript your runtimes support

Add "target": "es2022" (or the year your oldest runtime supports) to compilerOptions. The ES libraries up to that year load with it, and the same file passes. Setting module to nodenext also implies a recent target.

cache.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
const prices = new Map();

const ready = Promise.resolve(prices);

module.exports = { prices, ready };
The same file with a target.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "types": []
  },
  "include": ["*.js"]
}

TypeScript 6.0

TypeScript 6.0 changes the default target to the newest ECMAScript year and deprecates es5, per its release notes; the target page has the details. Writing target explicitly keeps the config's meaning the same across versions.

Under TypeScript 6.0 and 7.0

Every example on this page also runs under TypeScript 6.0.3 and 7.0.2 when this site is built. One of them reports something different from 5.9.3, the version the page describes; the ✗ on its badge links to its entry below.

target defaults to the newest ECMAScript year

TypeScript 6.0 and 7.0 · defaults that changed in 6.0

The pattern: Map or Promise in a project whose config sets neither target nor lib.

Why: Only the 6.0 default causes this. Without target, 5.9 assumed es5, whose library has no Map or Promise (TS2583, TS2585); 6.0 and 7.0 assume es2025. Source: TypeScript 6.0 release notes: Simple default changes.

No target in jsconfig.json, so the checker assumes ES5 cache.js

TypeScript 5.9.3
cache.js(2,20): error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
cache.js(5,15): error TS2585: 'Promise' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later.
TypeScript 6.0.3differs from 5.9.3

No errors.

TypeScript 7.0.2differs from 5.9.3

No errors.

What works in every version: Set target (and lib if you need one) explicitly.

The example The same file with a target on this page shows it, with the same result under every version.

Gotchas

  • Installing @types/node can hide this error, because the Node.js types load a newer library themselves. The code then passes for a reason unrelated to the config.
  • A newer lib than the runtime supports makes the checker accept methods that fail when the code runs; match the year to your oldest browser or Node.js version. Methods that are missing for the same reason are TS2550.

Sources

Last reviewed 20 October 2026.