mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
feat(types): simplify types
This commit is contained in:
@@ -20,7 +20,7 @@ export default class QueryComplexity {
|
||||
onOperationDefinitionEnter(operation: OperationDefinitionNode): void;
|
||||
onOperationDefinitionLeave(): GraphQLError | undefined;
|
||||
nodeComplexity(node: FieldNode | FragmentDefinitionNode | InlineFragmentNode |
|
||||
OperationDefinitionNode, typeDef: GraphQLObjectType<any, any> | GraphQLInterfaceType | GraphQLUnionType, complexity?: number): number;
|
||||
OperationDefinitionNode, typeDef: GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType, complexity?: number): number;
|
||||
createError(): GraphQLError;
|
||||
getDefaultComplexity(args: object, childScore: number): number;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ const resolve: GraphQLFieldResolver<any, any> = (source, args, context, info) =>
|
||||
context.flag = "f";
|
||||
};
|
||||
const fields: GraphQLFieldConfigMap<any, any> = {};
|
||||
let t: GraphQLObjectType<any, any>;
|
||||
let e: GraphQLObjectType<any, any>;
|
||||
let t: GraphQLObjectType;
|
||||
let e: GraphQLObjectType;
|
||||
const def = connectionDefinitions({
|
||||
connectionFields: fields,
|
||||
edgeFields: fields,
|
||||
|
||||
10
types/graphql-relay/index.d.ts
vendored
10
types/graphql-relay/index.d.ts
vendored
@@ -56,7 +56,7 @@ export const connectionArgs: GraphQLFieldConfigArgumentMap & ForwardConnectionAr
|
||||
|
||||
export type ConnectionConfigNodeTypeNullable =
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType;
|
||||
@@ -75,8 +75,8 @@ export interface ConnectionConfig {
|
||||
}
|
||||
|
||||
export interface GraphQLConnectionDefinitions {
|
||||
edgeType: GraphQLObjectType<any, any>;
|
||||
connectionType: GraphQLObjectType<any, any>;
|
||||
edgeType: GraphQLObjectType;
|
||||
connectionType: GraphQLObjectType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,8 +256,8 @@ export interface GraphQLNodeDefinitions {
|
||||
nodesField: GraphQLFieldConfig<any, any>;
|
||||
}
|
||||
|
||||
export type typeResolverFn = ((any: any) => GraphQLObjectType<any, any>) |
|
||||
((any: any) => Promise<GraphQLObjectType<any, any>>);
|
||||
export type typeResolverFn = ((any: any) => GraphQLObjectType) |
|
||||
((any: any) => Promise<GraphQLObjectType>);
|
||||
|
||||
/**
|
||||
* Given a function to map from an ID to an underlying object, and a function
|
||||
|
||||
6
types/graphql/execution/execute.d.ts
vendored
6
types/graphql/execution/execute.d.ts
vendored
@@ -136,7 +136,7 @@ export function buildExecutionContext(
|
||||
*/
|
||||
export function collectFields(
|
||||
exeContext: ExecutionContext,
|
||||
runtimeType: GraphQLObjectType<any, any>,
|
||||
runtimeType: GraphQLObjectType,
|
||||
selectionSet: SelectionSetNode,
|
||||
fields: { [key: string]: Array<FieldNode> },
|
||||
visitedFragmentNames: { [key: string]: boolean }
|
||||
@@ -146,7 +146,7 @@ export function buildResolveInfo(
|
||||
exeContext: ExecutionContext,
|
||||
fieldDef: GraphQLField<any, any>,
|
||||
fieldNodes: ReadonlyArray<FieldNode>,
|
||||
parentType: GraphQLObjectType<any, any>,
|
||||
parentType: GraphQLObjectType,
|
||||
path: ResponsePath
|
||||
): GraphQLResolveInfo;
|
||||
|
||||
@@ -180,6 +180,6 @@ export const defaultFieldResolver: GraphQLFieldResolver<any, any>;
|
||||
*/
|
||||
export function getFieldDef(
|
||||
schema: GraphQLSchema,
|
||||
parentType: GraphQLObjectType<any, any>,
|
||||
parentType: GraphQLObjectType,
|
||||
fieldName: string
|
||||
): Maybe<GraphQLField<any, any>>;
|
||||
|
||||
22
types/graphql/type/definition.d.ts
vendored
22
types/graphql/type/definition.d.ts
vendored
@@ -28,7 +28,7 @@ import { GraphQLSchema } from "./schema";
|
||||
*/
|
||||
export type GraphQLType =
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
@@ -44,9 +44,9 @@ export function isScalarType(type: any): type is GraphQLScalarType;
|
||||
|
||||
export function assertScalarType(type: any): GraphQLScalarType;
|
||||
|
||||
export function isObjectType(type: any): type is GraphQLObjectType<any, any>;
|
||||
export function isObjectType(type: any): type is GraphQLObjectType;
|
||||
|
||||
export function assertObjectType(type: any): GraphQLObjectType<any, any>;
|
||||
export function assertObjectType(type: any): GraphQLObjectType;
|
||||
|
||||
export function isInterfaceType(type: any): type is GraphQLInterfaceType;
|
||||
|
||||
@@ -91,14 +91,14 @@ export function assertInputType(type: any): GraphQLInputType;
|
||||
*/
|
||||
export type GraphQLOutputType =
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
| GraphQLList<any>
|
||||
| GraphQLNonNull<
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
@@ -121,7 +121,7 @@ export function assertLeafType(type: any): GraphQLLeafType;
|
||||
/**
|
||||
* These types may describe the parent context of a selection set.
|
||||
*/
|
||||
export type GraphQLCompositeType = GraphQLObjectType<any, any> | GraphQLInterfaceType | GraphQLUnionType;
|
||||
export type GraphQLCompositeType = GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType;
|
||||
|
||||
export function isCompositeType(type: any): type is GraphQLCompositeType;
|
||||
|
||||
@@ -214,7 +214,7 @@ export function assertWrappingType(type: any): GraphQLWrappingType;
|
||||
*/
|
||||
export type GraphQLNullableType =
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
@@ -234,7 +234,7 @@ export function getNullableType<T extends GraphQLNullableType>(type: GraphQLNonN
|
||||
*/
|
||||
export type GraphQLNamedType =
|
||||
| GraphQLScalarType
|
||||
| GraphQLObjectType<any, any>
|
||||
| GraphQLObjectType
|
||||
| GraphQLInterfaceType
|
||||
| GraphQLUnionType
|
||||
| GraphQLEnumType
|
||||
@@ -390,7 +390,7 @@ export interface GraphQLResolveInfo {
|
||||
readonly fieldName: string;
|
||||
readonly fieldNodes: ReadonlyArray<FieldNode>;
|
||||
readonly returnType: GraphQLOutputType;
|
||||
readonly parentType: GraphQLObjectType<any, any>;
|
||||
readonly parentType: GraphQLObjectType;
|
||||
readonly path: ResponsePath;
|
||||
readonly schema: GraphQLSchema;
|
||||
readonly fragments: { [key: string]: FragmentDefinitionNode };
|
||||
@@ -533,7 +533,7 @@ export class GraphQLUnionType {
|
||||
|
||||
constructor(config: GraphQLUnionTypeConfig<any, any>);
|
||||
|
||||
getTypes(): GraphQLObjectType<any, any>[];
|
||||
getTypes(): GraphQLObjectType[];
|
||||
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
@@ -542,7 +542,7 @@ export class GraphQLUnionType {
|
||||
|
||||
export interface GraphQLUnionTypeConfig<TSource, TContext> {
|
||||
name: string;
|
||||
types: Thunk<GraphQLObjectType<any, any>[]>;
|
||||
types: Thunk<GraphQLObjectType[]>;
|
||||
/**
|
||||
* Optionally provide a custom type resolver function. If one is not provided,
|
||||
* the default implementation will call `isTypeOf` on each implementing
|
||||
|
||||
12
types/graphql/type/introspection.d.ts
vendored
12
types/graphql/type/introspection.d.ts
vendored
@@ -10,13 +10,13 @@ import {
|
||||
} from "./definition";
|
||||
import { GraphQLField } from "./definition";
|
||||
|
||||
export const __Schema: GraphQLObjectType<any, any>;
|
||||
export const __Directive: GraphQLObjectType<any, any>;
|
||||
export const __Schema: GraphQLObjectType;
|
||||
export const __Directive: GraphQLObjectType;
|
||||
export const __DirectiveLocation: GraphQLEnumType;
|
||||
export const __Type: GraphQLObjectType<any, any>;
|
||||
export const __Field: GraphQLObjectType<any, any>;
|
||||
export const __InputValue: GraphQLObjectType<any, any>;
|
||||
export const __EnumValue: GraphQLObjectType<any, any>;
|
||||
export const __Type: GraphQLObjectType;
|
||||
export const __Field: GraphQLObjectType;
|
||||
export const __InputValue: GraphQLObjectType;
|
||||
export const __EnumValue: GraphQLObjectType;
|
||||
|
||||
export const TypeKind: {
|
||||
SCALAR: "SCALAR";
|
||||
|
||||
16
types/graphql/type/schema.d.ts
vendored
16
types/graphql/type/schema.d.ts
vendored
@@ -41,14 +41,14 @@ export class GraphQLSchema {
|
||||
|
||||
constructor(config: GraphQLSchemaConfig);
|
||||
|
||||
getQueryType(): Maybe<GraphQLObjectType<any, any>>;
|
||||
getMutationType(): Maybe<GraphQLObjectType<any, any>>;
|
||||
getSubscriptionType(): Maybe<GraphQLObjectType<any, any>>;
|
||||
getQueryType(): Maybe<GraphQLObjectType>;
|
||||
getMutationType(): Maybe<GraphQLObjectType>;
|
||||
getSubscriptionType(): Maybe<GraphQLObjectType>;
|
||||
getTypeMap(): TypeMap;
|
||||
getType(name: string): Maybe<GraphQLNamedType>;
|
||||
getPossibleTypes(abstractType: GraphQLAbstractType): ReadonlyArray<GraphQLObjectType<any, any>>;
|
||||
getPossibleTypes(abstractType: GraphQLAbstractType): ReadonlyArray<GraphQLObjectType>;
|
||||
|
||||
isPossibleType(abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType<any, any>): boolean;
|
||||
isPossibleType(abstractType: GraphQLAbstractType, possibleType: GraphQLObjectType): boolean;
|
||||
|
||||
getDirectives(): ReadonlyArray<GraphQLDirective>;
|
||||
getDirective(name: string): Maybe<GraphQLDirective>;
|
||||
@@ -77,9 +77,9 @@ export interface GraphQLSchemaValidationOptions {
|
||||
}
|
||||
|
||||
export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {
|
||||
query: Maybe<GraphQLObjectType<any, any>>;
|
||||
mutation?: Maybe<GraphQLObjectType<any, any>>;
|
||||
subscription?: Maybe<GraphQLObjectType<any, any>>;
|
||||
query: Maybe<GraphQLObjectType>;
|
||||
mutation?: Maybe<GraphQLObjectType>;
|
||||
subscription?: Maybe<GraphQLObjectType>;
|
||||
types?: Maybe<GraphQLNamedType[]>;
|
||||
directives?: Maybe<GraphQLDirective[]>;
|
||||
astNode?: Maybe<SchemaDefinitionNode>;
|
||||
|
||||
@@ -8,4 +8,4 @@ import { GraphQLObjectType } from "../type/definition";
|
||||
export function getOperationRootType(
|
||||
schema: GraphQLSchema,
|
||||
operation: OperationDefinitionNode | OperationTypeDefinitionNode
|
||||
): GraphQLObjectType<any, any>;
|
||||
): GraphQLObjectType;
|
||||
|
||||
Reference in New Issue
Block a user