Skip to content

Compiler runs out of memory when this types are added to Array<T> methods #9707

@sandersn

Description

@sandersn

TypeScript Version: master

Code

  1. In es5.d.ts, add this: this parameters to all Array methods
  2. Run inferringAnyFunctionType2 (reproduced below)
function f<T extends [(p1: number) => number]>(p: T): T {
    return p;
}

var v = f([x => x]);

Expected behavior:
The test passes

Actual behavior:
TypeScript runs out of memory.

It looks as if something about instantiating this types in a constraint evades the relation cache and keeps instantiating types. This might have something to do with the special handling of arrays and tuples, because I can't get the failure to repro when switching to a non built-in type.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions