Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Query component type definitions are incorrect #2552

Closed
Madumo opened this issue Oct 29, 2018 · 2 comments
Closed

Query component type definitions are incorrect #2552

Madumo opened this issue Oct 29, 2018 · 2 comments

Comments

@Madumo
Copy link
Contributor

Madumo commented Oct 29, 2018

Intended outcome:
The Query component should respect it's own type definitions.

Actual outcome:
The data property from the result parameter of the children function might be defined as an empty object. This goes against the type definitions.

How to reproduce the issue:
The children functions is called with QueryResults<TData, TVariables> as it's first param. According to the QueryResults typings, the result object contain a data property which is typed as TData | undefined.

According to that typing, if data is not undefined, it can only be of TData type. This is not the case. When the children function is called data might be an empty object which doesn't respect it's own typing.

Here is an example of the bug on codesandbox.
Note: to properly see the type checking within codesandbox, you must go to "preferences", and then under "experiments" toggle on the "Use VSCode in the browser" option.

Version

@elessarperm
Copy link

Same thing. It even changes every week or so. Last month the Query behaviour was like you said, then it was changed to never return an {} so I had to fix all Query usages to just check for undefined, and here we go again

@rosskevin
Copy link
Contributor

Closing as duplicate of #1917

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants