How to reflect field policy's read function return types in graphql-codegen?

Viewed 17

Assume this type policy:

// TLDR enum field of User object is replaced with some class instance on read
const userTypePolicies = {
  User: {
    fields: {
      status: {
        read: (value: STATUS_ENUM) => new UserStatus(value),
      },
    },
  },
};

How to reflect this behavior in graphql-codegen output? According to my generated types, User.status is of type STATUS_ENUM, but it should be of type UserStatus (cache is transforming enum to class on every read).

0 Answers
Related