softshipper
softshipper

Reputation: 34071

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 asp.net core as: enter image description here

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

The tsconfig.json looks like:

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

What is wrong?

Upvotes: 0

Views: 283

Answers (1)

Buns of Aluminum
Buns of Aluminum

Reputation: 2439

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 

Upvotes: 3

Related Questions