在配置primeng环境时遇到Error TS2304: Cannot find name 'Map'或has no exported member 'DomSanitizer'

时间:2021-07-10 12:19:31

1.先在根组件中(我的根组建是app.component.ts)加入///<reference path="../node_modules/angular2/typings/browser.d.ts"/>。就不会出现错误提示。或者将tsconfig.json中的target:es5变成target:es6,也能解决该错误提示

2.如果还会出现has no exported member 'DomSanitizer'的错误找到node_modules/primeng/components/fileupload/fileupload.d.ts文件,然后将文件中的import{DomSanitizer }from'@angular/platform-browser';改为import { DomSanitizationService as DomSanitizer } from '@angular/platform-browser';就可以解决该错误