简体   繁体   中英

Parameter error with Type-GraphQL - No type for parameter?

I am getting this error but am unsure as to what exactly is wrong because it follows the same format with the other resolvers I've created. This is the error:

`Error: You need to provide explicit type for Resolver#`getMultipleSomething parameter #2

This is my resolver:

@Resolver(() => Object)
export default class Resolver{
    constructor(
        private readonly service: Service
    ){}

    @Query(() => Object)
    async getSomething(@Arg('id') id : number) : Promise<Object>  {
        return await this.service.getSomething(id);
    }

    @Query(() => [Object])
    async getMultipleSomething(@Arg('page') page : number, @Arg('per_page') per_page : number, @Arg('stringArray') stringArray : string[])  {
        return await this.service.getSomethings(page, per_page, stringArray);
    }
}

Try @Arg('stringArray', type => [string]) stringArray: string[])

Ref: https://github.com/MichalLytek/type-graphql/issues/37#issuecomment-407664643

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM