This repository was archived by the owner on Dec 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
This repository was archived by the owner on Dec 8, 2021. It is now read-only.
Interface type safety #347
Copy link
Copy link
Closed
Labels
Description
Description
graphqlgen doesn't enforce type safety for type interfaces.
Steps to reproduce
Schema:
interface Availability {
isAvailable: Boolean!
}
type EstimatedAvailability implements Availability {
isAvailable: Boolean!
timestamp: Int!
}
type RemainingAvailability implements Availability {
isAvailable: Boolean!
remainingItems: Int!
}
type Offer {
availability: Availability!
}
Model classes:
export interface Availability {
isAvailable: boolean
}
export interface EstimatedAvailability {
isAvailable: boolean
timestamp: number
}
export interface RemainingAvailability {
isAvailable: boolean
remainingItems: number
}
export interface Offer {
availability: Availability
}
Expected results
export namespace OfferResolvers {
export type AvailabilityResolver = (
parent: Offer,
args: {},
ctx: Context,
info: GraphQLResolveInfo
) => Availability | Promise<Availability>;
export interface Type {
availability: (
parent: Offer,
args: {},
ctx: Context,
info: GraphQLResolveInfo
) => Availability | Promise<Availability>;
}
}
Actual results
export namespace OfferResolvers {
export type AvailabilityResolver = (
parent: Offer,
args: {},
ctx: Context,
info: GraphQLResolveInfo
) => {} | Promise<{}>;
export interface Type {
availability: (
parent: Offer,
args: {},
ctx: Context,
info: GraphQLResolveInfo
) => {} | Promise<{}>;
}
}
Versions
- graphqlgen: 0.4.0
- OS name and version: Node 8.11.2, NPM 6.4.1, Windows 10, 64 Bit