dotansimha / dotansimha/graphql-code-generator-community

[typescript-apollo-client-helpers] generated FieldPolicy type definitions

Open
#189 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

I added typescript-apollo-client-helpers to generate a typesafe `StrictTypedTypePolicies`. Looking at the generated FieldPolicy declarations for each entity type, I see they're all FieldPolicy, so when doing something like:

```
typePolicies: {
User: {
fields: {
displayName(existing) {
return existing;
},
},
},
}
```

The `existing` prop is of course `any` because of the generated FieldPolicy:

```
export type UserFieldPolicy = {
displayName?: FieldPolicy | FieldReadFunction,
};
```

I'm wondering if it's possible to - when used in tandem with the [Typescript](https://www.graphql-code-generator.com/plugins/typescript) plugin - have these `any`s replaced with the fields actual type definitions, which in my case looks like:

```
export type User = {
displayName: Maybe;
};
```

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.