question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[TypeScript Resolvers] Resolvers returned data type cannot be introspected

See original GitHub issue

Describe the bug Cannot introspect resolvers returned data

To Reproduce Steps to reproduce the behavior:

Clone repository: git clone -b graphql-ts https://github.com/swcarlosrj/SpaceX-API.git Install deps & start server: yarn && yarn start Generate types: yarn generate Introspect src/schema/capsule/resolvers.ts resolvers returned data

Expected behavior This would be the desired behaviour, it’s not even real because I’ve hardcoded QueryResolvers.CapsulesResolver from CapsulesResolver<...> = (Resolver<R, Parent, Context, CapsulesArgs> to CapsulesResolver<...> = Promise<Capsule[]>

I believe that it’s a TypeScript thing but it’d be incredible if we could have that feature using QueryResolvers.Resolvers as here, does it’s even possible?

Environment: OS: macOS Mojave 10.14.2 (18C54) Codegen: 0.15.2 Node: 10.10.0

Additional context It looks like that when you check the returned data type, it’s well formed (in this case Capsule[]) but I cannot see in VSCode the fields of my type/interface as here

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
itscarlosrufocommented, Jan 15, 2019

Sure, you can close it!

1reaction
kamilkisielacommented, Jan 3, 2019

@swcarlosrj this is how TypeScript works.

When you do this:

type Foo = string;

const query = {
  foo(): Foo /* <-- */ {
  	return 'Foo';
  }
}

TypeScript treats that as a shape of a returned value, not as function’s signature.

To have typed arguments and others, you would have to define that signature, otherwise it’s any. That’s why I don’t understand why not to put the TypeResolvers.Resolvers signature next to the object.

Read more comments on GitHub >

github_iconTop Results From Across the Web

typescript-resolvers - GraphQL Code Generator
This plugin generates TypeScript signature for resolve functions of your GraphQL API. You can use this plugin to generate simple resolvers ...
Read more >
Resolvers | NestJS - A progressive Node.js framework
Resolvers provide the instructions for turning a GraphQL operation (a query, mutation, or subscription) into data. They return the same shape of data...
Read more >
`__typename` returned by the server isn't match to graphql ...
Problem. I think when I query to API { __schema { types { name } } }.
Read more >
API Reference: ApolloServer - Apollo GraphQL Docs
This article documents the ApolloServer class from the @apollo/server package. You can use the ApolloServer class to create an instance of Apollo Server ......
Read more >
type-graphql/Lobby - Gitter
Could not obtain introspection result, received: {"status_code":404 ... Hi all, is it possible to somehow access a resolver's methods within a decorator?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found