Skip to content

Default values in default value of input types #615

@backbone87

Description

@backbone87

Describe the Bug
When defining a default value for an input type, its default values are not applied. I am not sure if its a problem of type-graphql or graphql-js.

To Reproduce

@InputType()
class MyInput {
  @Field(() => Int, { defaultValue: 30 })
  public take!: number;
}
@Resolver()
class MyResolver {
  @Query(() => Boolean)
  public myQuery(@Arg('arg', { defaultValue: {} }) arg: MyInput): boolean {
    console.log(arg);
    return true;
  }
}
{
  myQuery
}

with this query the log output is {}

Expected Behavior
the log output should be {take:30}

Environment (please complete the following information):

  • Docker: node:12-alpine
  • Package version: 0.18.0-beta.17
  • TypeScript version: 3.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions