Skip to content

useLoadingValue error is typed Error not FirebaseError #89

@r-bt

Description

@r-bt

Firstly, thanks for the great library :) I'm trying to use it with typescript but the return type from all the firebase hooks are returning errors typed as Error rather than FirestoreError. For example

// useCollection.ts

export type CollectionHook = LoadingHook<firestore.QuerySnapshot, Error>;

...

const { error, loading, reset, setError, setValue, value } = useLoadingValue<
    firestore.QuerySnapshot,
    Error
  >();

The error objects themselves though are Firebase Errors (as they have the code attribute).

This seems to have had been fixed in v1 with #18 but are now back to Error type in V2. Not sure if this was intentional or not, if not and it should be typed as FirestoreError I'd be more than happy to submit a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions