【发布时间】:2020-07-03 12:01:41
【问题描述】:
我一直在尝试在最近的 nodejs 项目中使用type-graphql。我已经能够成功实现@Query 方法,但我一生都无法让以下工作。我正在将它与 Molecler 服务一起使用。
@Mutation()
// eslint-disable-next-line class-methods-use-this
removeValue((@Arg("value") value: number): void {
console.log(value);
}
我收到以下错误
/home/micro-api/node_modules/type-graphql/dist/helpers/findType.js:10
metadataDesignType = reflectedType[parameterIndex];
^
/home/micro-api/node_modules/type-graphql/dist/helpers/findType.js:1
TypeError: Cannot read property '0' of undefined
有什么想法吗?我看到一些 cmets 在我的搜索中提到了反射,但由于我对 node 和 typescript 还很陌生,所以我有点卡住了。
【问题讨论】:
-
你按照官方设置说明一步一步来了吗? typegraphql.com/docs/next/installation.html你用 babel 吗?如果是,您是否有适当的 typescript 和反射相关插件?
标签: typescript graphql typegraphql