Created
May 5, 2016 23:40
-
-
Save sheerun/30dae1da9e74af47ce91ca19d031bfac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
export class GraphQLSchema { | |
getQueryType() { | |
return "foobar"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
export class ThirdPartyGraphQLSchema { | |
getQueryType() { | |
return "fizfuz"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
export interface IGraphQLSchema { | |
getQueryType(): string | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @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()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @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