graphql/graphql-js ? reverse-engineered prompt

Reverse engineered prompt

Build me a TypeScript GraphQL library that lets me define a schema, add object types and fields, and run queries against that schema from code. I want the main flow to feel simple, like create a schema with a root query type, then call a graphql function with a query string and get back either data or clear validation errors.

Please make it work in both Node and the browser, and keep it organized so the core pieces are easy to understand and test. Include a few example queries and the kind of tests that show valid queries returning data, and invalid queries returning helpful messages with locations. If there are any current GraphQL docs or spec details you need, look them up online and match the common behavior people expect from GraphQL.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab