typescript - 添加参数装饰器会破坏 azure 函数
问题描述
我将 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 装饰器,它可以正常构建和运行,我还在代码中的其他地方使用装饰器,并且一切正常。
我在这里缺少什么吗?
解决方案
推荐阅读
- angular - 在 Angular 2+ 中检测点击绑定
- c# - 使用 AsNoTracking,如何检查急切加载的导航属性是否为空?
- delphi - 如何使用泛型处理集合
- c# - 选择项目时,ComboBox ItemSourceProperty 失去绑定
- .htaccess - 使用 htaccess 从特殊 url 替换空间
- android - 无法识别启动活动
- c++ - 使用 TCP 协议的 C++ 文件传输
- java - Spring Qualifier 名称基于 Spring MVC 中的 spring 配置文件
- java - Unsing Java 的供应商接口以促进单元测试的模拟行为
- angular - 角度中的base href:在运行时更改base-href?