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

could it be possible to specify arguments only via an inline type? #8

Closed
capaj opened this issue May 4, 2018 · 1 comment
Closed

Comments

@capaj
Copy link

capaj commented May 4, 2018

like so I could write it:

@Type class Query {
  @Field test(_ : any, args : {
    tools: [String]
  }) : Boolean {
    console.log(args);
    return true;
  }
}

instead of

class TestArguments {
  @Field([String])tools : [String]
}

@Type class Query {
  @Field test(_ : any, args : TestArguments) : Boolean {
    return true;
  }
}

? Should be doable-we can just generate a name of that type from the @field

@MichalLytek
Copy link

It's not possible in this shape. Class with decorator is the simplest way to have both compile time (type) and runtime info about args. Defining the object shape type inline will result in Object type in reflection system.

@capaj capaj closed this as completed May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants