Skip to content

Conversation

@lukeKonopka
Copy link
Contributor

@lukeKonopka lukeKonopka commented Jun 3, 2020

Description

We know that if isLoaded() helper returns true the argument is not undefined.
I added an overload to isLoaded function type so that it will narrow type of its argument.

Unfortunately this only works for single argument (we can't have type predicates that reference spread arguments).

Check List

If not relevant to pull request, check off as complete

  • All tests passing
  • Docs updated with any changes or examples if applicable
  • Added tests to ensure new feature(s) work properly

Relevant Issues

Fixes #955

@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #956 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #956   +/-   ##
=======================================
  Coverage   88.33%   88.33%           
=======================================
  Files          29       29           
  Lines         797      797           
=======================================
  Hits          704      704           
  Misses         93       93           

@prescottprue prescottprue changed the base branch from master to v3.6.0 June 19, 2020 02:36
@prescottprue prescottprue merged commit 045a70d into prescottprue:v3.6.0 Jun 19, 2020
@prescottprue prescottprue mentioned this pull request Jun 19, 2020
3 tasks
prescottprue added a commit that referenced this pull request Jun 19, 2020
* feat(types): add database and firestore statics (#957) - @msutkowski, @themindoverall, @phryneas
* feat(types): add type predicate to `isLoaded` (#956) - @lukeKonopka
* chore(docs): formatting fixes in firestore docs section (#959) - @gregfenton
* feat(docs): add firestore populate docs (#954) - @harveychow

Co-authored-by: gregfenton <[email protected]>
Co-authored-by: Matt Sutkowski <[email protected]>
Co-authored-by: Chris Serino <[email protected]>
Co-authored-by: Harvey Chow <[email protected]>
Co-authored-by: Luke Konopka <[email protected]>
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

Successfully merging this pull request may close these issues.

Typescript - isLoaded should narrow type

2 participants