Skip to content

@Query overwrites previously defined methods #81

@stelcheck

Description

@stelcheck
// @ObjectType creates GraphQLObjectType from a class
@ObjectType()
class QueryType {
  public prefix = 'Hello'
  @Field() public greeting(): string {
    return `${this.prefix}, world!`
  }

  @Field() public original(): string {
    return `${this.prefix}, world!`
  }
}

// @ObjectType creates GraphQLObjectType from a class
@ObjectType()
class QueryType2 {
  public prefix = 'Hi'
  @Field() public greeting(): string {
      return `${this.prefix}, world!`
  }
}

// @Schema creates GraphQLSchema from a class.
// The class should have a field annotated by @Query decorator.
@Schema()
class SchemaType {
    @Query() public query1: QueryType
    @Query() public query2: QueryType2

}

original remains callable, but now there are no longer any ways of calling the original greeting from QueryType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions