mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 19:09:18 +08:00
Merge pull request #24236 from filipows/master
Add typings for graphql-list-fields
This commit is contained in:
42
types/graphql-list-fields/graphql-list-fields-tests.ts
Normal file
42
types/graphql-list-fields/graphql-list-fields-tests.ts
Normal file
@@ -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);
|
||||
11
types/graphql-list-fields/index.d.ts
vendored
Normal file
11
types/graphql-list-fields/index.d.ts
vendored
Normal file
@@ -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 <https://github.com/filipows>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { GraphQLResolveInfo } from "graphql";
|
||||
|
||||
declare function getFieldList(info: GraphQLResolveInfo): string[];
|
||||
|
||||
export = getFieldList;
|
||||
23
types/graphql-list-fields/tsconfig.json
Normal file
23
types/graphql-list-fields/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/graphql-list-fields/tslint.json
Normal file
1
types/graphql-list-fields/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user