You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.mutate() method of apollo-angular uses FetchResult<T> for the return type, which internally uses ExecutionResult<T> from graphql module itself. The data property in ExecutionResult defined as optional and nullable. This brings problems because TS always complain that data might be null even when your mutation result is neve nullable (we use types generated from the schema). So you have to fight with nullability and of course, it's confusing because the schema result is non-nullable.
In contradiction query method defines data as data<T>, so we don't have this problem for queries.
What would be a solution to this?
The text was updated successfully, but these errors were encountered:
fetis
changed the title
FetchtResutl for mutation
FetchtResult for mutation
Mar 17, 2020
Holla!
.mutate()
method of apollo-angular usesFetchResult<T>
for the return type, which internally usesExecutionResult<T>
from graphql module itself. Thedata
property inExecutionResult
defined as optional and nullable. This brings problems because TS always complain that data might benull
even when your mutation result is neve nullable (we use types generated from the schema). So you have to fight with nullability and of course, it's confusing because the schema result is non-nullable.In contradiction
query
method defines data asdata<T>
, so we don't have this problem for queries.What would be a solution to this?
The text was updated successfully, but these errors were encountered: