Skip to content

Export Query's Result typeΒ #218

@james-ritchey

Description

@james-ritchey

Which @ngneat/query-* package(s) are relevant/releated to the feature request?

query

Description

I saw this issue but couldn't reopen it, so I created a new one.

In the above linked issue the issue is typing a value set by calling the query function, so ResultType seems like it should work. My issue is that I'm typing the return of that function in the function signature, like

getTodoById(todoId: string): Result<QueryObserverResult<Todo, Error>> {
...
}

Reason for this is so this function returns the query object itself and handle it as needed in another function/class/etc and be type safe. For now I've just duplicated the type locally, though its not perfect since the Result type uses the different types for the update options function param.

Proposed solution

Add Result as an exported type for Query

Alternatives considered

Currently replicating the type locally as best I can, also attempted ResultType but that doesnt seem to work in this instance.

Do you want to create a pull request?

Yes

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