Reputation: 37
I have this field in a model but doesn't work
@Field(type => [],{ nullable: true })
product: string[];
I don't know what I miss.
Upvotes: 2
Views: 6018
Reputation: 11973
You need to add the GraphQL type String
. Therefore change []
to [String]
, an array of strings. You might also want to set product
optional (with ?
) since it is nullable
.
@Field(type => [String], { nullable: true })
product?: string[];
Upvotes: 6