TypeScript TS2693: ‘Promise’ only refers to a type, but is being used as a value here error occurs when you are trying to create a new Promise without having the proper Promise type definition in your environment.
To fix the TS2693: ‘Promise’ only refers to a type, but is being used as a value here error, install the es6-promise package and its type definitions.
npm install --save es6-promise
npm install --save-dev @types/es6-promise
Import the es6-promise
package in your TypeScript file.
import 'es6-promise/auto';
const myPromise = new Promise((resolve, reject) => {
// Your code here
});
This solution ensures you have a Promise implementation available in environments that don’t natively support ES6 Promises.
However, if your target environment already supports ES6 Promises, you can fix this error by including the appropriate lib configuration in your tsconfig.json file.
{
"compilerOptions": {
"target": "es6", // or a later version like "es2017", "es2020", etc.
"module": "commonjs",
...
},
...
}
If you are targeting ES5, but your environment has native support for Promises, you can include the es2015.promise library in your tsconfig.json file.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"lib": [
"es2015.promise",
"dom",
"es5"
],
...
},
...
}
If you cannot modify your tsconfig.json file or you want to import the Promise type manually, you can install a separate type definition for promises.
The @types/es6-promise package provides type definitions for ES6-style Promises. Install it using the below command.
npm install --save-dev @types/es6-promise
Then, in your TypeScript file, you can import the Promise type:
import { Promise } from 'es6-promise';
const myPromise = new Promise((resolve, reject) => {
// Your code here
});
Conclusion
By configuring your tsconfig.json file or importing the Promise type, you can fix the TypeScript error TS2693: ‘Promise’ only refers to a type, but is being used as a value here.

Niva Shah is a Software Engineer with over eight years of experience. She has developed a strong foundation in computer science principles and a passion for problem-solving.