Skip to content

Incorrect types for suspense #1297

@inssein

Description

@inssein

Describe the bug
I have been playing around with v2 and v3 to experiment for a new project, and have noticed that the returned type for useQuery is incorrect with suspense.

I am beginning to think there should be an aliased function with different return types for suspense.

To Reproduce

  1. Write any code that uses useQuery
const { data } = useQuery<Todo[]>('todos', getTodos);
  1. Notice that you can't use data in a typescript project without first checking if its undefined because the returned type is Todo[] | undefined

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