prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 556 forks source link

feat(types): add type predicate to isLoaded #956

Closed lukeKonopka closed 4 years ago

lukeKonopka commented 4 years ago

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

Relevant Issues

Fixes #955

codecov[bot] commented 4 years ago

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