webpack TS2304 Cannot find name 'Map', 'Set', 'Promise'

后端 未结 15 2176
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 07:07

I have the following webpack.config.js

var path = require(\"path\");
var webpack = require(\'webpack\');

module.exports = {
  entry: {
    \'ng2-auto-comple         


        
相关标签:
15条回答
  • 2020-12-01 07:51

    To solve this you only need to import map method in your ts file like this:

    import { map } from 'rxjs/operators';
    
    0 讨论(0)
  • 2020-12-01 07:54

    Map, Set and Promise are ES6 features.
    In your tsconfig.json you are using:

    "target": "es5" 
    

    This causes the compiler to use the normal es5 lib.d.ts, which lacks the definitions for the above types.

    You want to use the lib.es6.d.ts:

    "target": "es6" 
    
    0 讨论(0)
  • 2020-12-01 07:56

    In your tsconfig.json just change "target": "es5" to "target": "es6"

    0 讨论(0)
提交回复
热议问题