Closed
Description
TypeScript Version: 2.1.5 and nightly (2.2.0-dev.20170125)
Node Version: 6.9.4 64-bit (probably not relevant)
Code
I have changed type annotation in my code from
export function create<Props extends { }>(info: TypeInfoBase, traits?: TypeTraits): Type<Props & CommonProps>
to
export function create<T extends Any>(info: TypeInfoBase, traits?: TypeTraits): Type<T['props']>
Here is the change in the full context.
I did the change because using the original approach
const X = create<{ prop: number }>(...)
type X = typeof X._Entity
resulted in loosing typename in typedoc documentation.
Instead, I decided to use
interface X extends Entity<{ props: number }> {}
const X = create<X>(...)
Expected behavior:
The code compiles and does not crash.
Actual behavior:
Code takes extremely long to compile or crashes.
If I modify the code to
export function create<T extends Any>(info: TypeInfoBase, traits?: TypeTraits): Type<T & any>
the problem goes away. (I am using T & any
because I am using the noUnusedLocals flag and would have to change more code).
Steps to reproduce:
Compiles without problems:
git clone https://github.com/dsehnal/LiteMol.git
cd LiteMol
npm install
git checkout 04314ab
gulp
Crashes on "Viewer and Examples" task and takes too long on "Bootstrap" task:
git stash
git checkout c075025
gulp
The error I am getting is:
<--- Last few GCs --->
55484 ms: Mark-sweep 1345.9 (1433.7) -> 1342.6 (1434.2) MB, 1105.7 / 0.0 ms [
allocation failure] [GC in old space requested].
56710 ms: Mark-sweep 1342.6 (1434.2) -> 1342.4 (1434.2) MB, 1225.5 / 0.0 ms [
allocation failure] [GC in old space requested].
57887 ms: Mark-sweep 1342.4 (1434.2) -> 1344.5 (1403.2) MB, 1177.3 / 0.0 ms [
last resort gc].
59057 ms: Mark-sweep 1344.5 (1403.2) -> 1346.5 (1403.2) MB, 1169.3 / 0.0 ms [
last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 000001B4D2ACFB61 <JS Object>
1: getNodeLinks [g:\Test\LiteMol\node_modules\typescript\lib\typescript.js:~
24871] [pc=000003923497B90A] (this=000001B4D2AE6659 <JS Global Object>,node=0000
03159B6D0029 <a NodeObject with map 0000004590944209>)
2: isSymbolOfDeclarationWithCollidingName [g:\Test\LiteMol\node_modules\type
script\lib\typescript.js:~42858] [pc=0000039234857861] (this=000001B4D2AE6659 <J
S Global Object>,sym...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memo
ry