Search code examples
typescriptgraphqltypeorm

I'm getting the CannotDetermineGraphQLTypeError and can't fix it


My code:

@InputType()
export class RegisterUserInput implements Partial<User> {
  @Field()
  id!: number;

  @Field()
  userName!: string;

  @Field()
  firstName!: string;

  @Field()
  lastName!: string;

  @Field()
  password!: string;

  @Field()
  role!: string;

  @Field((type) => [Assignment])
  assignments!: Assignment[];
}

CannotDetermineGraphQLTypeError: Cannot determine GraphQL input type for 'assignments' of 'RegisterUserInput' class. Does the value used as its TS type or explicit type is decorated with a proper decorator or is it a proper input value?


Solution

  • Check if the user class has the @ObjectType() decorator. else delete your build folder and rebuild again