TS2564 (TS) Property has no initializer TypeScript error in Visual Studio 2017 – How to fix

The Fix

If the problem is related to a NPM package the first thing to do is to update it to its latest version, as the author had most likely already experienced that and possibly came out with an update to properly address the new behaviour. If the issue is happening inside our own code, the best thing we can do is to fix that manually by adding the definite assignment assertion modifier like explained above: in most scenarios, a bunch of     placed in the right spots will be enough fix your project.

If you cannot do that, we can choose to disable the new feature by setting the   initialization flag to false in the   section within our tsconfig.json configuration file; alternatively, we can also add the    command-line switch to turn off this checking.

In the unlikely case both of the above fixes won’t be enough, try to temporarily downgrade to TypeScript <= 2.6 and see if the error persists.

Source: https://www.ryadel.com/en/ts2564-ts-property-has-no-initializer-typescript-error-fix-visual-studio-2017-vs2017/

 

Unable to get property ‘apply’ of undefined or null reference occurred

Below is error message when I try to run ASP.NET Core Web Application (ASP.NET Core 2.1) with Angular in Visual Studio 2017.

0x800a138f – JavaScript runtime error: Unable to get property ‘apply’ of undefined or null reference occurred

In order to fix this issue, need to modify ClientApp/src/polyfills.ts as shown below.

Uncomment highlighted lines

polyfill

Another solution if you don’t have polyfills.ts in your project

If you don’t have polyfills.ts in your project below is another solution I got it from stackoverflow.com

Source: https://stackoverflow.com/questions/44641907/how-fix-unable-to-get-property-apply-of-undefined-or-null-reference-error-wi

 

One solution is to work with polyfills.ts as says here

But in many cases do not have polyfills.ts file… So in this cases the solution that works for me is this….

Under ClientApp directory of the solution there is a file called

boot.browser.ts

Under line 2 that that says

import 'zone.js';

Add this

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/set';

/***********added*************/