如果我想在没有任何参数的情况下使用interface/implements
,我该怎么做?
我目前的代码如下:
interface User {
GUID: String
name: String
age: Int
}
type FacebookUser implements User
type GoogleUser implements User
我这样做的原因是处理FacebookUsers的年龄增长和GoogleUsers在Resolvers功能方面的年龄变化。 如果他们没有要求年龄,我根本不想得到它们。
如果我添加它,它可以工作:
interface User {
GUID: String
name: String
age: Int
}
type FacebookUser implements User {
bogus: String
}
type GoogleUser implements User {
bogus: String
}
但除了底层系统之外,没有什么可以区分用户,所以我不想为它们添加特定的字段。
我正在使用Apollo GraphQL Tools 3.0.2