我在GraphQL和TypeScript小项目中有一个类型错误

发布于 2025-02-13 11:47:34 字数 1255 浏览 0 评论 0 原文

错误说:类型'{args:{user_id:{type:graphqlscalartype< number,number>;;;;;;;;;;;;;;;;; }; user_name:{type:graphqlscalartype< string,string>;; }; bank_accounts:{type:graphqlscalartype< string,string>;; }; };解析(父:任何,Args:any):any; }'但在类型'graphqlfieldconfig< any,任何,任何>'中都需要。

11个字段:{addaccountdetails:create_user},

这是我的代码链接

https://drive.google.com/file/d/1xxa5rdqushzeppda3fgxd9l2cl8uiad0/view?usp = sharing?usp = sharing

如果您想下载并安装NPM模块,则可以检查。另外,我附上了错误图片。请查看这个非常基本的错误。

当我声明自己的类型帐户时,它在index.ts文件中显示错误文字。

在这里,我为帐户创建了一个新的GraphQl对象。

我想在红色文本中实现这一目标。我怎么能得到它?请帮我。

error says: property 'type' is missing in type '{ args: { user_id: { type: GraphQLScalarType<number, number>; }; user_name: { type: GraphQLScalarType<string, string>; }; bank_accounts: { type: GraphQLScalarType<string, string>; }; }; resolve(parent: any, args: any): any; }' but required in type 'GraphQLFieldConfig<any, any, any>'.

11 fields: {addAccountDetails:CREATE_USER},

This is my code link

https://drive.google.com/file/d/1XxA5RDQUshzeppDA3FgXD9l2CL8uIAD0/view?usp=sharing

if you wish to download and install the npm module then you can check. also, I attached my error pictures. Please see that very basic error.

enter image description here

when I declare my own type account it shows an error in the index.ts file as you can see in the above error says the text.

enter image description here

Here I created a new Graphql object for an account.

enter image description here

I want to achieve this in the red text. how can I get it? please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光暖心i 2025-02-20 11:47:34

如果要制作 bank_accounts 字符串数组,则应使用 graphQllist 这样:

bank_accounts: { type: new GraphQLList(GraphQLString) }

另外,如果您打算将ID存储在数组中,则最好使用 graphqlid 而不是 GraphQlString

If you want to make bank_accounts string array you should use GraphQLList like this:

bank_accounts: { type: new GraphQLList(GraphQLString) }

Also if you plan to store ids in the array it would be better to use GraphQLID instead of GraphQLString.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文