Skip to content
Discussion options

You must be logged in to vote
export const createRecordResolver = <
  T extends Record,
  Input extends Partial<T>
>(
  objectTypeCls: ClassType<T>,
  inputTypeCls: ClassType<Input>
) => {
  @Resolver({ isAbstract: true })
  abstract class BaseResolver {
    @Mutation((type) => objectTypeCls)
    async createRecord(@Arg('record', () => inputTypeCls) recordInput: Input) {
      console.log(recordInput);
    }
  }

  return BaseResolver;
};

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jpbarbosa
Comment options

Answer selected by jpbarbosa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1029 on September 16, 2021 06:40.