Skip to content

Weird heap overflow when compiling a single line of code with recursive type definition. #30831

Closed
@Veetaha

Description

@Veetaha

TypeScript Version: typescript@3.4.2, typescript@3.5.0-dev.20190409

Search Terms:

  • Heap overflow

Code

type Foo<T> = Extract<{[i in keyof T]: Foo<T[i]>; }[0], 0>;

Expected behavior:
Should print an error for indexing object literal with 0 or using circular references.
Or at least the same behavior as in v3.3.4000:

Output when compiled with `typescript@3.3.4000`

image

Actual behavior:

NodeJS standard heap crash report: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Details

image

Playground from typescriptlang.com produces in-browser heap memory allocation failure:

Details

image

Playground Link:

Klick me if you are not afraid of crashing your browser's heap

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions