vulcan-npm icon indicating copy to clipboard operation
vulcan-npm copied to clipboard

Use of TData might be wrong

Open eric-burel opened this issue 3 years ago • 2 comments

It's not clear in Apollo whether the generic type "TData" refers to the type of "document" or type of the response. For example, if it refers to the document, we could have TData = { hello: string }, so it matches the schema. If it refers to the data, we could have TData = { data: { createFoo : { document: { hello: string }}, so TData would vary amongs mutations.

The second case is more likely in Apollo. But what we want in Vulcan is the first case. We should introduce a new TModel generic which is the type of the model, and try to build the corresponding "TData" automatically.

The biggest issue is that the name of the resolver is dependent on the model (createFoo, createBar), it is not static so hard to precompute in typescript.

eric-burel avatar Sep 30 '20 08:09 eric-burel