我在后端和前端之间共享一个对象类型。我将其用作验证器,当Graphql在客户端和服务器之间交换数据时,它只发送这些对象类型的数据。
这是一个AuthenticationInput对象:
import { Field, InputType } from "type-graphql";
@InputType()
export class AuthenticationInput {
@Field({nullable: false})
email: string;
@Field({nullable: false})
password: string
}这在后端和前端都存在。在后端,即运行在graphQL上的阿波罗服务器上,没有问题。然而,在客户端,我得到了这个错误:
Support for the experimental syntax 'decorators-legacy' isn't currently enabled我的tsconfig.json中确实有"experimentalDecorators":true。我不知道该怎么办。我得到了Field和InputType的错误。
与webpack一起运行,next.js,react,typescript。
谢谢。
发布于 2019-09-12 19:08:44
问题是这些配置无法在客户端运行,并且与React不兼容。
https://stackoverflow.com/questions/57791707
复制相似问题