【问题标题】:"Decorators-legacy" isn't currently enabled“Decorators-legacy”当前未启用
【发布时间】: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


    【解决方案1】:

    问题是这些配置不能在客户端运行并且与 React 不兼容。

    【讨论】:

    • 有什么解决办法吗?
    猜你喜欢
    • 1970-01-01
    • 2020-11-30
    • 1970-01-01
    • 2019-02-15
    • 2021-02-09
    • 2019-06-17
    • 1970-01-01
    • 2020-11-30
    相关资源
    最近更新 更多