Open
Description
Describe the bug
At the moment is the result of useQuery
defined as Ref<TResult>
. But shouldn't it be Ref<undefined|TResult>
.
While the Query is executed result.value
will be undefined.
Example
setup () {
const {result} = useQuery<UsePostsResult>()
const posts = computed(() => result.value.posts)
return {posts}
}
This example would create an error, because undefined.posts
is not available. The typescript check doesn't notice this error because result.value
is defined to be UsePostsResult
.
Expected behavior
The result should be marked as possibly undefined.
Versions
vue: 2.6.11
vue-apollo: 4.0.0-alpha.10
apollo-client: 2.6.10