You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm going through the tutorial but implementing using TypeScript and tsx instead of Javascript. I'm stuck at the services/index.ts
import{request,gql,GraphQLClient}from'graphql-request';constgraphqlAPI=process.env.GRAPHCMS_SECRET;exportconstgetPosts=async()=>{constquery=gql` query MyQuery { postsConnection { edges { node { author { bio name id image { url } } createdAt slug title excerpt featuredImage { url } categories { name slug } } } } } `constresult=awaitrequest(graphqlAPI,query);returnresult.postConnection.edges;}
All of the fields return this error:
Unknown field "postsConnection": The parent selection or operation does not resolve to a valid schema type
and the graphqlAPI param in the return throws this error:
S2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'.
I don't know where to assign the string datatype or how to make this schema valid, it's exactly like the one in the video but this one throws error for some reason
The text was updated successfully, but these errors were encountered:
I'm going through the tutorial but implementing using TypeScript and tsx instead of Javascript. I'm stuck at the services/index.ts
All of the fields return this error:
Unknown field "postsConnection": The parent selection or operation does not resolve to a valid schema type
and the graphqlAPI param in the return throws this error:
S2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'.
I don't know where to assign the string datatype or how to make this schema valid, it's exactly like the one in the video but this one throws error for some reason
The text was updated successfully, but these errors were encountered: