RASEL MAHMUD
RASEL MAHMUD

Reputation: 61

I got a type error in the Graphql and typescript small project

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.

Upvotes: 0

Views: 269

Answers (1)

Okan Aslan
Okan Aslan

Reputation: 174

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.

Upvotes: 1

Related Questions