【问题标题】:How to use apollo codegen typescript types in code?如何在代码中使用 apollo codegen typescript 类型?
【发布时间】:2018-12-09 13:46:24
【问题描述】:

生成的类型很棒,但我应该如何使用它们?结果的嵌套字段是_加入的接口所以导入这么长的类型名感觉不对...

在我的代码中我有这样的东西......

export interface InterviewerHistory_viewer_interviews_edges_node {
  id: string;
  scheduledTime: string;
  interviewerId: string;
  intervieweeId: string | null;
  participants: (InterviewerHistory_viewer_interviews_edges_node_participants | null)[] | null;
  intervieweeReview: InterviewerHistory_viewer_interviews_edges_node_intervieweeReview | null;
}

如果我想在其中一些字段上运行某些函数并且我必须输入 args,那将非常令人困惑和奇怪......我使用这个工具有误吗?

【问题讨论】:

    标签: typescript graphql apollo


    【解决方案1】:

    尝试降级您的apollo-codegen 版本。

    我升级到apollo-codegen 0.20.0后遇到同样的问题,所以我降级到0.19.0,接口名称更好一点。

    【讨论】:

    • 是的,我只是保持最新状态并处理它,但感谢您提供的信息
    猜你喜欢
    • 2019-11-12
    • 2021-11-16
    • 2020-07-08
    • 2020-12-21
    • 2019-07-30
    • 2020-01-04
    • 2020-03-22
    • 2019-11-16
    • 2021-10-04
    相关资源
    最近更新 更多