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

null cast away in valueChanges() #1319

Closed
timblakely opened this issue Nov 2, 2017 · 2 comments
Closed

null cast away in valueChanges() #1319

timblakely opened this issue Nov 2, 2017 · 2 comments

Comments

@timblakely
Copy link
Contributor

AngularFire:

5.0.0-rc.3

If the document does not exist, this line returns action.payload.data() : null, which is in turn casted to T, dropping the null case. Seems like the return type for valueChanges() should be Observable<T|null>.

@davideast
Copy link
Member

@timblakely Yep, it sure should! Care to make the PR?

@larssn
Copy link
Contributor

larssn commented Jan 15, 2018

But any type can always implicitly be null. Observable<T|null> is the same as Observable<T>.

VSCode will even ignore the |null part of a return type.

EDIT
Ignore what I said; with strictNullChecks enabled, it is still relevant.

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

No branches or pull requests

3 participants