I am new with GraphQL and I don't know how to pass a TypeScript type to ReturnTypeFunction of @Field decorator.
my code is as below :
export type WorokingHours = [number, number];
// [ [ 8, 13 ], [ 16, 22 ] ]
@Field(() => [WorokingHours], {
nullable: true,
description: storeWorkingHours
})
@prop()
workingHours?: WorokingHours[];
and I will get this error message:
'WorokingHours' only refers to a type, but is being used as a value here.ts(2693)
how can fix this error?
do you have any idea to implement the duration that my stores are actives in my DB?
GraphQL spec doesn't support tuples, so you need to use list [Number] or explicit object type { one: number, two: number } instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With