1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
//// [tests/cases/compiler/inferrenceInfiniteLoopWithSubtyping.ts] ////
//// [graphql-compose.d.ts]
export type ObjMapReadOnly<T> = Readonly<{ [key: string]: Readonly<T> }>;
export type Thunk<T> = (() => T) | T;
export type ComposeOutputTypeDefinition = Readonly<ObjectTypeComposer<any, any> | EnumTypeComposer>;
export class EnumTypeComposer {
public setFields(fields: { [name: string]: { [key: string]: any } }): this;
}
export class ObjectTypeComposer<TSource, TContext> {
public setFields(fields: ObjMapReadOnly<Resolver>): this;
public addResolver<TResolverSource>(opts: { type?: Thunk<ComposeOutputTypeDefinition> }): this;
}
export class Resolver {
public wrapArgs<NewContext>(
cb: () => {
[argName: string]: Thunk<Readonly<EnumTypeComposer>>;
}
): void;
public wrapType(cb: () => ComposeOutputTypeDefinition): void;
}
//// [app.ts]
import { ObjectTypeComposer } from './graphql-compose';
declare const User: ObjectTypeComposer<any, any>;
User.addResolver({
type: User, // `User as any` fix the problem
});
//// [app.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
User.addResolver({
type: User, // `User as any` fix the problem
});
//// [app.d.ts]
export {};
|