App that compiles and runs using immutable 4.3.2, fails to start after upgrading to 4.3.3. Seems to be caused by #1932
Attempting to run app results in error:
Error: Failed to initialize Angular compilation - Maximum call stack size exceeded
To duplicate:
- Create an angular app -
npx @angular/cli new TestApp (choose no routing and css)
- Install immutable 4.3.2 -
npm i immutable@4.3.2
- In tsconfig.json change the value of
noImplicitOverride option from true to false.
- Replace the contents of app.component.ts with the following (which kind of captures the problematic code in more or less the way its actually presenting):
import { Component } from '@angular/core';
import { /*DeepCopy,*/ List, Record } from 'immutable';
export interface Props {
foos?: List<Foo>;
}
const defaults: Props = {
foos: undefined // null
};
const fooRecord = Record(defaults, 'Foo');
export class Foo extends fooRecord implements Props {
foos?: List<Foo>;
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'TestApp';
// either of these causes issue
// bar: DeepCopy<Foo>;
bar = List<Foo>([new Foo()]).toJS();
}
- Run the app -
npm start. It starts as expected.
- Upgrade to immutable 4.3.3 -
npm i immutable@4.3.3
- Run the app -
npm start. App fails to start with Error: Failed to initialize Angular compilation - Maximum call stack size exceeded
If line 15 - foos?: List<Foo>; is commented out we get a more descriptive error:
Error: src/app/app.component.ts:28:3 - error TS2615: Type of property 'foos' circularly references itself in mapped type '{ [ObjectKey in keyof Props]: DeepCopy<Props[ObjectKey]>; }'.
28 bar = List<Foo>([new Foo()]).toJS();
App that compiles and runs using immutable 4.3.2, fails to start after upgrading to 4.3.3. Seems to be caused by #1932
Attempting to run app results in error:
Error: Failed to initialize Angular compilation - Maximum call stack size exceededTo duplicate:
npx @angular/cli new TestApp(choose no routing and css)npm i immutable@4.3.2noImplicitOverrideoption from true to false.npm start. It starts as expected.npm i immutable@4.3.3npm start. App fails to start withError: Failed to initialize Angular compilation - Maximum call stack size exceededIf line 15 -
foos?: List<Foo>;is commented out we get a more descriptive error: