Skip to content

QueryResult are too generic #1211

@CreativeTechGuy

Description

@CreativeTechGuy

Describe the bug
QueryResult has a lot of generic types when more specific types could be used to make code easier to write and less assertions/checks necessary to use the various return values. For example, if isSuccess === true then data will never be undefined. If isError === true then error will never be null, etc.

To Reproduce
Not sure about repro steps since this is a TypeScript issue/improvement.

Expected behavior
I'd expect the QueryResult type to be one of several distinct types for each of the possible combinations. This means that if isSuccess is true, then is* will be false and every other combination similar.

Screenshots
N/A

Additional context
N/A

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