add graphql-fields typings

This commit is contained in:
feinoujc
2018-11-21 21:40:53 -05:00
parent c8b8c10fce
commit 809fc1d291
4 changed files with 51 additions and 0 deletions
@@ -0,0 +1,8 @@
import { GraphQLResolveInfo } from 'graphql';
import graphqlFields = require('graphql-fields');
const info = ({} as any) as GraphQLResolveInfo;
const fieldsWithSubFieldsArgs = graphqlFields(info, {}, { processArguments: true });
const fieldsWithoutTypeName = graphqlFields(info, {}, { excludedFields: ['__typename'] });
graphqlFields(info);
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for graphql-fields 1.3
// Project: https://github.com/robrichard/graphql-fields#readme
// Definitions by: feinoujc <https://github.com/feinoujc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { GraphQLResolveInfo } from 'graphql';
declare function graphqlFields(info: GraphQLResolveInfo, obj?: object, opts?: graphqlFields.Options): any;
declare namespace graphqlFields {
interface Options {
processArguments?: boolean;
excludedFields?: string[];
}
}
export = graphqlFields;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"esnext.asynciterable"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"graphql-fields-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }