Typescript: OOM heap crash with -d or -w, and --noImplicitThis

Created on 13 Feb 2019  路  2Comments  路  Source: microsoft/TypeScript


TypeScript Version: 3.2 - 3.4.0-dev.20190213


Search Terms:
memory heap crash

Code

function createObj() {
  return {
    func1() {
      return this;
    },
    func2() {
      return this;
    },
    func3() {
      return this;
    },
    func4() {
      return this;
    },
    func5() {
      return this;
    },
    func6() {
      return this;
    },
    func7() {
      return this;
    },
    func8() {
      return this;
    },
    func9() {
      return this;
    }
  };
}

Expected behavior:

Run: tsc --noImplicitThis -d test.ts

No crash. There's no crash when there's only 8 functions, but the generated declaration file is 41 MB!

Actual behavior:

With 9 member functions tsc runs out of memory and crashes.

Playground Link:

Related Issues:

Needs Proposal Suggestion

Most helpful comment

I am determined to let the 9-member version of this run to completion on my machine (36 minutes and counting)

All 2 comments

Here's the 3-member version .d.ts output for reference:

declare function createObj(): {
    func1(): {
        func1(): any;
        func2(): {
            func1(): any;
            func2(): any;
            func3(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
        };
        func3(): {
            func1(): any;
            func2(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
            func3(): any;
        };
    };
    func2(): {
        func1(): {
            func1(): any;
            func2(): any;
            func3(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
        };
        func2(): any;
        func3(): {
            func1(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
            func2(): any;
            func3(): any;
        };
    };
    func3(): {
        func1(): {
            func1(): any;
            func2(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
            func3(): any;
        };
        func2(): {
            func1(): {
                func1(): any;
                func2(): any;
                func3(): any;
            };
            func2(): any;
            func3(): any;
        };
        func3(): any;
    };
};

I am determined to let the 9-member version of this run to completion on my machine (36 minutes and counting)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Antony-Jones picture Antony-Jones  路  3Comments

DanielRosenwasser picture DanielRosenwasser  路  3Comments

Roam-Cooper picture Roam-Cooper  路  3Comments

siddjain picture siddjain  路  3Comments

wmaurer picture wmaurer  路  3Comments