Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@sheerun
Created May 5, 2016 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sheerun/30dae1da9e74af47ce91ca19d031bfac to your computer and use it in GitHub Desktop.
Save sheerun/30dae1da9e74af47ce91ca19d031bfac to your computer and use it in GitHub Desktop.
/* @flow */
export class GraphQLSchema {
getQueryType() {
return "foobar";
}
}
/* @flow */
export class ThirdPartyGraphQLSchema {
getQueryType() {
return "fizfuz";
}
}
/* @flow */
export interface IGraphQLSchema {
getQueryType(): string
};
/* @flow */
import type { IGraphQLSchema } from './types';
import { GraphQLSchema } from './class1';
import { ThirdPartyGraphQLSchema } from './class2';
export function printSchema(schema: IGraphQLSchema) {
console.log(schema.getQueryType());
}
printSchema(new GraphQLSchema());
printSchema(new ThirdPartyGraphQLSchema());
/* @flow */
import type { IGraphQLSchema } from './types';
export function isGraphqlSchema(schema: IGraphQLSchema) {
return typeof schema.getQueryType === 'function';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment