dolittle / vanir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Look into a build tool that can provide more reflection information for TypeScript to avoid having to have decorators to pick this up

einari opened this issue · comments

This would be super useful for when we automatically generate GraphQL mutations for events. Right now we have to take a JSON payload as string to be able to use these.

An idea here could also be to generate enough metadata to start applying conventions. Convention resolvers could look at structure (location on disk) in combination with information from the AST. For instance look for marker interfaces or type suffixes.

Examples of this could be commands and command handlers - something we use GraphQL for, but have to be very explicit about decorators that tell what is a resolver, InputType, Field and such. This could all be generated for us, partially through capturing enough reflection data and then resolve it at runtime - or another approach would be to use TTypeScript compiler that enables running transforms at compile time and then inserting the necessary bits such as the @Resolver() decorator in front of those classes that match the convention.