Angular Decorator Problem

An example of the problem with creating a custom class decorator for Components

by elezar

HTML

<div id="output">

</div>

<button id="btn">
Tester
</button>

JavaScript

let MatModalRaceEthnicityComponent2 = class MatModalRaceEthnicityComponent {
	testVal = 'uh-oh';
  
  testfunc = function test_Factory() {
    return new MatModalRaceEthnicityComponent2();
  }
}

MatModalRaceEthnicityComponent2 = class TestJLC extends MatModalRaceEthnicityComponent2 {
	testVal = 'good';
};

function onclick() {
	document.getElementById('output').innerText = new MatModalRaceEthnicityComponent2().testfunc().testVal;
}

document.getElementById('btn').addEventListener('click', onclick);