dotansimha/graphql-code-generator-community

[typescript-vue-apollo][withCompositionFunctions] Accept readonly types for variables types

Open

#99 建立於 2020年12月15日

在 GitHub 查看
 (0 留言) (4 反應) (0 負責人)TypeScript (195 fork)github user discovery
help wanted

倉庫指標

Star
 (136 star)
PR 合併指標
 (PR 指標待抓取)

描述

Is your feature request related to a problem? Please describe.

We use the composition functions generated with typescript-vue-apollo with withCompositionFunctions config flag. We also use readonly types in parts of the codebase.

Currently, when we want to feed a readonly type as a variable to such generated composition function, we have to cast it or otherwise copy readonly types to mutable types, because the composition function's type expects mutable values.

Describe the solution you'd like

Preferably, the generated useQuery composition functions would accept both readonly and mutable types as variables and options props, as the assumption is that VueApolloComposable.useQuery should not mutate those values.

Describe alternatives you've considered

Currently, we have to cast the readonly values to mutable types when feeding them to the generated useQuery function, otherwise TypeScript raises error.

貢獻者指南