typegql
typegql copied to clipboard
How to use mutation with array?
I try
@Mutation({type: Number, description: ''})
public async addSkillsSwToProfile(skillsSwInputDto: [SkillsSwInputDto]): Promise<number> {
return 1;
}
and getting Error: @Type SavageWorlds.addSkillsSwToProfile(skillsSwInputDto <-------): Could not infer type of argument. Make sure to use native GraphQLInputType, native scalar like 'String' or class decorated with @InputObjectType
graphqlmastery.com writes use GraphQLList
Hey,
typegql is not able to automatically infer array types. You'd need to decorate your argument skillsSwInputDto like @Arg({type: [SkillsSwInputDto]}) skillsSwInputDto: SkillsSwInputDto[])