diff --git a/types/graphql-list-fields/graphql-list-fields-tests.ts b/types/graphql-list-fields/graphql-list-fields-tests.ts new file mode 100644 index 0000000000..7624a3cbd8 --- /dev/null +++ b/types/graphql-list-fields/graphql-list-fields-tests.ts @@ -0,0 +1,42 @@ +import getFieldNames = require("graphql-list-fields"); + +import { + GraphQLID, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLResolveInfo, + GraphQLSchema, + GraphQLString +} from "graphql"; + +const sampleGraphQLResolveInfo: GraphQLResolveInfo = { + fieldName: "", + fieldNodes: [], + returnType: GraphQLString, + parentType: new GraphQLInterfaceType({ + name: "Sample", + fields: { + name: { type: GraphQLString } + } + }), + path: undefined, + schema: new GraphQLSchema({ + query: new GraphQLObjectType({ + name: "SampleType", + fields: {} + }) + }), + fragments: {}, + rootValue: null, + operation: { + kind: "OperationDefinition", + operation: "query", + selectionSet: { + kind: "SelectionSet", + selections: [] + } + }, + variableValues: {} +}; + +const fieldNames: string[] = getFieldNames(sampleGraphQLResolveInfo); diff --git a/types/graphql-list-fields/index.d.ts b/types/graphql-list-fields/index.d.ts new file mode 100644 index 0000000000..362658deb9 --- /dev/null +++ b/types/graphql-list-fields/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for graphql-list-fields 2.0 +// Project: https://github.com/jakepusateri/graphql-list-fields#readme +// Definitions by: Chris Filipowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { GraphQLResolveInfo } from "graphql"; + +declare function getFieldList(info: GraphQLResolveInfo): string[]; + +export = getFieldList; diff --git a/types/graphql-list-fields/tsconfig.json b/types/graphql-list-fields/tsconfig.json new file mode 100644 index 0000000000..6f53c2c900 --- /dev/null +++ b/types/graphql-list-fields/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "graphql-list-fields-tests.ts" + ] +} diff --git a/types/graphql-list-fields/tslint.json b/types/graphql-list-fields/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/graphql-list-fields/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }