Type-graphql: using @ArgsType with array of inputs

Created on 14 Feb 2020  路  3Comments  路  Source: MichalLytek/type-graphql

Hi, I had a problem on using ArgsType() with an array of inputs.

my ArgsType looks like this

@ObjectType()
class UserInfo{
  @Field()
  username: string;
  @Field()
  email: string
}
@ArgsType()
export class DriverArgs {
  @Field()
  collection: string;
  @Field(type=>[UserInfo])
  userInfo: UserInfo[];
}

but it is failing with the following error Cannot determine GraphQL input type for IUserInfo.

Kindly need your help.

Thanks

Community Question Solved

All 3 comments

@itsgracian since you're using UserInfo in Input, you should add @InputType() decorator on it.

In addition to @ObjectType()

Hey @GrayStrider, thank you so much.

Was this page helpful?
0 / 5 - 0 ratings