TypeScript v 3.0.3: Cannot find global type 'Promise'
See original GitHub issueI am seeing the following error while trying to compile using TypesScript v3.0.3. There is no context other than what you see below. I don’t know if this is coming from tslint or the compiler. Has anyone seen this error and can give me a clue as to what might be wrong? I am using Promise<void> through out my code.
Failed to compile. (undefined,undefined): Cannot find global type ‘Promise’.
Here is the content of my tsconfig.json file (ignore the “…” that appears for the “paths” value):
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "out/",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noEmitHelpers": true,
"jsx": "react",
"lib": ["dom", "es2016", "es2017", "esnext.asynciterable"],
"types": ["jest"],
"target": "es2017",
"module": "esnext",
"moduleResolution": "node",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"strict": true,
"strictFunctionTypes": false,
"pretty": true,
"removeComments": true,
"sourceMap": true,
"skipLibCheck": true,
"paths": {
. . .
}
},
"include": ["src/**/*", "typings/*"],
"exclude": [
"node_modules",
"src/**/*.spec.*",
"build",
"scripts",
"webpack",
"src/setupTests.ts",
"vendor"
]
}
Thanks in advance for any hints anyone might be able to provide.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
error TS2304: Cannot find name 'Promise' - Stack Overflow
You just need to change your target to es6 inside your tsconfig.json to resolve this issue. { "version":"2.13.0", "compilerOptions": ...
Read more >Documentation - TypeScript 4.5
TypeScript 4.5 introduces a way to override a specific built-in lib in a manner similar to how @types/ support works. When deciding which...
Read more >TS2468 Cannot find global value 'Promise'--unit tests only
I have a Node project that uses typescript 2.5.2 (though this bug has been there since TS 2.1). In my unit tests I...
Read more >Understanding TypeScript Configuration Options
TypeScript. This post will walk you through how tsconfig.json works in your application with some examples. Example Repo. Here is a link to...
Read more >TypeScript Cheatsheet, Common Errors, and More
types /azure/index.d.ts" /> ). By design, The TypeScript compiler does not search the global installed modules directory when resolving ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Based on one of the other problems I was running into, this appears to be a problem in compatibility between typescript and tslint versions. Using typescript 3.0.3 requires running tslint 5.11.0. I had tslint 5.10.0 installed. Closing this ticket. Unfortunately, with the error that was reported, there was no context indicating that this could have been a problem with tslint.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.