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.
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.