Skip to content

Maximum call stack size exceeded #14896

Closed
@jamesknelson

Description

@jamesknelson

TypeScript Version: 2.2.1

Note that this is a separate bug from #14723 and is not fixed by #14874 as noted by @ahejlsberg

Code

type Attributes<Keys extends string> = {
    [Key in Keys]: string; // I'm actually using Attribute<Key> in my code, but `string` is all that is needed to cause the RangeError
}

class Query<A extends Attributes<keyof A>> {
    multiply<B extends Attributes<keyof B>>(x: B): Query<A & B>;
}

Expected behavior:

Should compile

Actual behavior:

Fails to compile with stack trace:

/usr/local/lib/node_modules/typescript/lib/tsc.js:51296
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26081:33)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26166:38)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26139:42)
    at typeRelatedToEachType (/usr/local/lib/node_modules/typescript/lib/tsc.js:26351:35)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26125:34)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26189:42)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26147:38)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26153:38)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26153:38)
    at isRelatedTo (/usr/local/lib/node_modules/typescript/lib/tsc.js:26153:38)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions