Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support type-graphql's plans for a more advanced reflection system #7

Closed
vjpr opened this issue Apr 28, 2019 · 3 comments
Closed

Support type-graphql's plans for a more advanced reflection system #7

vjpr opened this issue Apr 28, 2019 · 3 comments
Labels
question Further information is requested

Comments

@vjpr
Copy link

vjpr commented Apr 28, 2019

type-graphql is a popular TS library for GraphQL. They plan on writing a TS compiler extension to DRY up type info in field definitions.

MichalLytek/type-graphql#296

How hard would it be to support this? Do you have time? Could you provide some pointers on the difficulties and where to begin?

@leonardfactory
Copy link
Owner

Hi @vjpr, if I'm correct the typegraphql plugin is currently checking for a limited field of usage, like supporting promises and arrays, as seen here.

The Reflect.metadata output is here, and it seems to me that the typegraphql:info is a simple object literal with some info. It should not be hard to implement it in the plugin, and maybe I can find some time in the next weeks to add support (surely behind a flag).

However, I cannot find a spec in order to understand the desired output. The code seems to do the following:

  1. Promises unwrapping (Promise<T> is treated as T)
  2. Arrays unwrapping
  3. Unions are processed but only as T | null (i.e. T | U is not supported)

These things may be implemented, but since this is a POC I'd like to have more info from the awesome job made by @19majkel94, since I'm worried do proceed without a clean plan ahead. Do you have any info / plans / specs available? I was not able to find them in the repo

@MichalLytek
Copy link

I don't have a proper specs as I don't know how much info I will need. The plans are described here:
https://github.com/19majkel94/typegraphql-reflection-poc#further-work

I am going to create a TypeGraphQL-specific plugin and in the feature I might turn it into an universal reflection plugin with described specs that can be implemented e.g. by a babel plugin.

But the very future step might be not possible in current babel typescript pipeline as I would like to provide support for raw TS constructs like interfaces, without constraints to classes and decorators only.

@leonardfactory leonardfactory added the question Further information is requested label Jul 25, 2019
@leonardfactory
Copy link
Owner

Closing this, if someone has news feel free to let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants