Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

class member cannot be declared optional auth.d.ts & firebase_object_observable.d.ts #479

Closed
ykoehler opened this issue Aug 29, 2016 · 8 comments

Comments

@ykoehler
Copy link

Using

"angularfire2": "^2.0.0-beta.3-pre2",
"typings": "^1.3.3"

I am getting the following errors:

node_modules/angularfire2/auth/auth.d.ts(11,20): error TS1112: A class member cannot be declared optional.
node_modules/angularfire2/database/firebase_object_observable.d.ts(6,17): error TS1112: A class member cannot be declared optional.

@davideast
Copy link
Member

Upgrade to 2.0.0-beta.4 and try again.

Make sure you are not installing the Firebase types from the manual_typings folder as those are deprecated. The Firebase npm package contains the official typings.

@ykoehler
Copy link
Author

I did try 2.0.0-beta.4 same issue.

I also fail to see why changing the firebase typings would remove those optional class members statement.

When using the official firebase typings I get additional errors about missing 'firebase'. So not good.

I manually removed the two ? Character to remove the optional and things works.

@davideast
Copy link
Member

I also fail to see why changing the firebase typings would remove those optional class members statement.
The typings are different, so it's good to be on the correct version.

I think this is your TypeScript version. Can you do a tsc -v and see what it outputs? If it's less than 2.0 try installing TypeScript 2.0:

npm install -g typescript@2.0

Then try again.

@ykoehler
Copy link
Author

It probably is the case, but my understanding is that 2.0 is not out yet.

https://www.npmjs.com/package/typescript

typescript typescript published 5 months ago
1.8.10 is the latest of 422 releases

As such, AngularFire2 should either require it explicitly or not use the 2.0.0 functionality at this time (maybe using a branch for those).

@ykoehler
Copy link
Author

Issue #250 discuss the same type of problem in different location.

@davideast
Copy link
Member

@ykoehler This is a beta library, and we require TypeScript 2.0 as it will be released before we are in production. Please install 2.0 if you want to use the project. You can also use TypeScript as local module if you don't want to upgrade your global module yet.

@ykoehler
Copy link
Author

I have updated my typescript to 2.0.2 and typings to 1.3.3, I removed my typings and node_modules and re-installed.

I am getting the same errors I was at the very begining;

node_modules/angularfire2/angularfire2.d.ts(13,66): error TS2503: Cannot find namespace 'firebase'.

The firebase is no more global and is within a namespace. Firebase2 doesn't seems to be aware of that.

@AhsanAyaz
Copy link

+1
Been searching for these error whole day. Still now clue for the solution.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants