我将 type-graphql 与 Azure Functions 打字稿一起使用,一切正常,除非我尝试创建输入类型,如下所示:
@ObjectType()
class Recipe {
@Field(type => ID)
id: string;
@Field(type => [String])
ingredients: string[]
}
@Resolver(of => Recipe)
class RecipeResolver {
@Query(returns => Recipe, { nullable: true })
recipe(@Arg("title") title: string): Promise<Recipe | undefined> {
return undefined
}
}
@Arg("title") 似乎正在破坏 azure 函数,当它在那里时,当我尝试在本地部署和测试函数时出现以下错误:
[错误] Worker 无法加载函数 graphql:'TypeError: Cannot read property '0' of undefined'
如果没有 @Arg 装饰器,它可以正常构建和运行,我还在代码中的其他地方使用装饰器,并且一切正常。
我在这里缺少什么吗?