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
TodoItem (the return type of createTodo) is guaranteed to """implement""" union Todo. Yet this requires additional type-guard function (aka. validators). In the end the new typesafe updaters code is a lot more cumbersome to deal with, in comparison to the old unsafe variant. Not to mention all of the new concepts of assignability and updatability being thrown back at you.
The text was updated successfully, but these errors were encountered:
Malien
changed the title
Type-safe updaters non-assignability of unions
Type-safe updaters: non-assignability of unions
Dec 29, 2023
I'm exploring possibilities of opening a PR. Would need some time to familiarise myself with the compiler. Luckily compilers and Rust are not foreign to me
I seem to have encountered an issue with the new typesafe updaters. Here's the basic repro: https://github.com/Malien/typesafe-relay-updaters-repro
Obligatory "using typescript, not flow" mention
Assume we have a simple Todo app with todo groupings. Like this:
Make coffeeBreadLet us have the following gql schema:
given the query:
and the mutation
the update of
fails to typecheck, since the generated types from
TodoListAddTodoMutation
is:__isTodoList_assignable_todo
is optional.This seems to be related to the sections of the docs "where is guaranteed to implement an interface"/"where is not guaranteed to implement an interface", yet this seems like a missed case.
TodoItem
(the return type ofcreateTodo
) is guaranteed to """implement""" unionTodo
. Yet this requires additional type-guard function (aka. validators). In the end the new typesafe updaters code is a lot more cumbersome to deal with, in comparison to the old unsafe variant. Not to mention all of the new concepts of assignability and updatability being thrown back at you.The text was updated successfully, but these errors were encountered: