【发布时间】:2020-01-07 13:01:54
【问题描述】:
我在后端和前端之间共享一个对象类型。我将它用作验证器,当 Graphql 在客户端和服务器之间交换数据时,它只发送这些对象类型的数据。
这是一个 AuthenticationInput 对象:
import { Field, InputType } from "type-graphql";
@InputType()
export class AuthenticationInput {
@Field({nullable: false})
email: string;
@Field({nullable: false})
password: string
}
这存在于后端和前端。在 graphQL 上运行的 apollo 服务器的后端没有问题。但是,在客户端我收到此错误:
Support for the experimental syntax 'decorators-legacy' isn't currently enabled
我的 tsconfig.json 中确实有 "experimentalDecorators": true。我不知道该怎么办。我收到 Field 和 InputType 的错误。
使用 webpack、next.js、react、typescript 运行。
谢谢。
【问题讨论】:
标签: reactjs typescript graphql-js typescript-decorator