Skip to content

Missing undefined possible type with conditional skip in useSuspenseQuery #12942

@simPod

Description

@simPod

Issue Description

const { data } = useSuspenseQuery(
    MyDocument,
    var === undefined
      ? { skip: true }
      : { variables: { x: var.x } },
  );

type of data is wrongly inferred to not be undefined. But the type should be T|undefined since skip is possible.

Link to Reproduction

do we have a TS template?

Reproduction Steps

No response

@apollo/client version

3.14.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions