Skip to content
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

firebase3.d.ts(33,50): error TS2304: Cannot find name 'Promise'. #246

Closed
katowulf opened this issue Jun 20, 2016 · 8 comments
Closed

firebase3.d.ts(33,50): error TS2304: Cannot find name 'Promise'. #246

katowulf opened this issue Jun 20, 2016 · 8 comments
Assignees
Milestone

Comments

@katowulf
Copy link
Contributor

katowulf commented Jun 20, 2016

When attempting to use the AngularFire2 guide here, I run into this error after adding "node_modules/angularfire2/firebase3.d.ts" into my tsconfig.json file.

katowulf-macbookpro:ngrepro katowulf$ tsc
node_modules/angularfire2/firebase3.d.ts(33,50): error TS2304: Cannot find name 'Promise'.

No other action seems to be necessary, other than including the typings. Steps to repro are very simple:

  1. git clone https://github.com/katowulf/ng2repro.git
  2. npm install
  3. tsc (or same error via npm start)
  4. Note the error
  5. Remove firebase3.d.ts line from tsconfig.json
  6. Note that the error is gone.

Tried various permutations of systemjs.config.js and main.ts. Most of them are still commented in the files for reference.

@katowulf
Copy link
Contributor Author

Forgot a couple potentially useful notes:

  1. I used @angular/[email protected] because rc.1 won't run with quickstart or router guides
  2. I'm not using the Angular CLI

@jeffbcross
Copy link
Contributor

Thanks, I think we need to update the guides to mention installation of the promise typings.

@joni8a
Copy link

joni8a commented Jun 26, 2016

What is the solution then ?

@davideast
Copy link
Member

@joni8a typings install es6-promise --ambient

@joni8a
Copy link

joni8a commented Jun 27, 2016

Tanks, but when I do it I get this error: typings install es6-promise --ambient typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead

When I change --ambient to --globale I get: typings install es6-promise --global typings ERR! message Attempted to compile "es6-promise" as a global module, but it looks like an external module. You'll need to remove the global option to continue.

So I remove the --globale, but then I get no dependencies: typings install es6-promise es6-promise └── (No dependencies)

To be honest I am not really clear on this typings thing, any help greatly appreciated :)

@joni8a
Copy link

joni8a commented Jun 27, 2016

I tried this: typings install dt~es6-promise --global --save But I still get: node_modules/angularfire2/firebase3.d.ts(33,50): error TS2304: Cannot find name 'Promise'.

This is what I did:
1)Clone the angular2 starter
2)npm install
3)npm install angularfire2 firebase --save
4)typings install dt~es6-promise --global --save
5)Add "files": [ "node_modules/angularfire2/firebase3.d.ts" ] to tsconfig.json

I dont get any errors if I set the target to es6, but then the code is not translated to javascript.

@shamrozwarraich
Copy link

facing the same problem any help plz...:/

@jeffbcross jeffbcross self-assigned this Jun 30, 2016
@jeffbcross
Copy link
Contributor

You'll need to add a reference to the files array of your tsconfig.json.

files: [
  "typings/main.d.ts"
]

main.d.ts will import any typings that were installed by typings, as long as the --save flag is used.

jeffbcross added a commit to jeffbcross/angularfire2 that referenced this issue Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants