首页 > 解决方案 > 错误 TS2345:“X”类型的参数不可分配给“QueryDeepPartialEntity”类型的参数'

问题描述

我不知道如何解决这个问题,

error TS2345: Argument of type 'BookUpdateParseInput' is not assignable to parameter of type 'QueryDeepPartialEntity<Book>'.
  Types of property 'author' are incompatible.
    Type 'Author | undefined' is not assignable to type 'number | (() => string) | undefined'.
      Type 'Author' is not assignable to type 'number | (() => string) | undefined'.
        Type 'Author' is not assignable to type '() => string'.
          Type 'Author' provides no match for the signature '(): string'.

114                 await this.bookRepository.update(bookId.id, await this.parseInput(input));

这是我遇到此问题的代码部分

@Mutation(()=> Boolean)
        async updateBookById(
            @Arg('bookId',()=> BookIdInput) bookId: BookIdInput,
            @Arg ('input',()=> BookUpdateInput) input: BookUpdateInput,
        ): Promise<Boolean>{
            try{
                await this.bookRepository.update(bookId.id, await this.parseInput(input));
                return true;
            }catch(e){
                throw new Error(e)
            }
        }

标签: javascripttypescript

解决方案


推荐阅读