-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript compile error: 'Promise' only refers to a type, but is being used as a value here. #2422
Comments
While I can't try this on my end, some things caught my eyes like |
It seems the cause was declaring |
If I transpile my Typescript Project (a NodeJS-Application), then I get exactly the same two errors. I use commonjs modules in tsconfig.json node_modules/rxjs/Observable.d.ts(1,25): error TS2307: Cannot find module 'promise'. |
Here my Repo to reproduce https://github.com/thomas3577/rxjs-node-typescript Just run npm start |
Can we please reopen this issue? It's still an issue .. @thomas3577 repo demonstrates it quite well. Changing the target to |
Fixed by adding |
@ds82 Even I am facing the same issues with rxjs. Could you please help how did you integrate bluebird and corejs libraries within the code? |
To fix the ts build issue it should be enough to do this:
In the files I use promises I also added edit: If you want to use bluebird in your code, you have to install it, too |
@ds82 Anything to be included in tsconfig.json ? |
Nope. |
I'm still receiving this error when targeting Tried to all sorts of combinations with But i'm still receiving:
|
FWIW, I have this same error on my own project and I have identified this is because my repo is a monorepo |
What does it mean? I have the same error. |
Same error in reactxp Solved: "compilerOptions": {
"lib": ["es5", "es2015", "dom", "scripthost"]
} |
Thanks a million @tje3d! |
I'm using Visual Studio with an Angular CLI-based project and experienced Typescript intellisense errors referring to this issue and several others. In my case, I need to still target older browsers (which apparently is what the "es5" setting is for). Setting the "target" to "es2015" did not allow me to run the app in IE, for instance. This is what I had to do for es2017:
It got the errors in visual studio to go away. So far the app is running fine in Chrome and IE. EDITAfter seeing the errors go away, they showed up again today :( |
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. |
I'm seeing the following compile error when trying to compile a small Angular/Rx project:
RxJS version: 5.2.0
Code to reproduce:
typings.json
tsconfig.json
Angular service (edited)
I'm pretty stumped and can't find examples online of other people with seeing exactly the same issue.
The text was updated successfully, but these errors were encountered: