dotansimha/graphql-code-generator-community

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

Open

#99 aberto em 15 de dez. de 2020

Ver no GitHub
 (0 comments) (4 reactions) (0 assignees)TypeScript (195 forks)github user discovery
help wanted

Métricas do repositório

Stars
 (136 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

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.

Guia do colaborador