zero_coding zero_coding - 1 year ago 148
TypeScript Question

Errors appear when using rxjs in typescript

I downloaded rxjs via with following command:

npm install @reactivex/rxjs

in the folder src contains many ts files:
enter image description here

Then I copied the src folder into my project based on core as:
enter image description here

Then Visual Studio compiler complains a lot of things:
enter image description here

looks like:

"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"outDir": "../wwwroot/js"
"exclude": [

What is wrong?

Answer Source

You may need to target ES6 in your tsconfig.json file. tsconfig.json

"compilerOptions": {
    "target": "ES6"

Or, you may need to install a polyfill that handles Promises (and more) and has typings for Typescript, like core-js.

npm install typings core-js
typings install –global –save dt~core-js 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download