-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Closed
Copy link
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: Version 3.5.0-dev.20190503
Search Terms:
tsc, RangeError, Maximum call stack size exceeded
Code
import { ObjectTypeComposer } from 'graphql-compose';
declare const User: ObjectTypeComposer<any, any>;
User.addResolver({ type: User });
Dramatically simplified 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;
}
Expected behavior:
Do not fall with Maximum call stack size exceeded
error.
Actual behavior:
> [email protected] tsc /Users/nodkz/www/_sandbox/nodkz-tsc-problem
> tsc
/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:72973
throw e;
^
RangeError: Maximum call stack size exceeded
at __generator (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:30:13)
at getUnmatchedProperties (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37203:20)
at getUnmatchedProperty (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37237:20)
at typesDefinitelyUnrelated (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37245:19)
at inferFromObjectTypes (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37544:22)
at inferFromTypes (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37456:29)
at inferFromContravariantTypes (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37475:21)
at applyToParameterTypes (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37047:17)
at inferFromSignature (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37603:21)
at inferFromSignatures (/Users/nodkz/www/_sandbox/nodkz-tsc-problem/node_modules/typescript/lib/tsc.js:37595:21)
Playground Link:
Simplified repro repo: https://github.com/nodkz/tsc-problem
git clone https://github.com/nodkz/tsc-problem ./nodkz-tsc-problem \
&& cd nodkz-tsc-problem \
&& npm install \
&& npm run tsc
JadenH, toverux, antoniopresto, koskimas, rohit-gohri and 51 morebasarat, koskimas, jaxxreal and BoryaMogilajaxxreal, nin-jin, Inaztm, vladkosinov, szhaqypbek and 6 morepumano
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFixedA PR has been merged for this issueA PR has been merged for this issue