繁体   English   中英

如何使用graphql-js类(无SDL)扩展现有类型?

[英]How to extend an existing type using graphql-js classes (no SDL)?

使用SDL,我可以这样做:

extend type Query {
   something: String!
}

通过内置的GraphQLObjectType类构建类型时,该怎么办?

它似乎没有记录在任何地方。

这个图书馆可能有帮助吗? https://graphql-compose.github.io/docs/en/intro-quick-start.html

做完了

const AuthorTC = TypeComposer.create({ name: 'Author', fields: { id: 'Int!', firstName: 'String', lastName: 'String', }, });

然后您可以执行addFields

````AuthorTC.addFields({...})

````

并获取GraphQLObjectType

````

AuthorTC.getType()````

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM