第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Angular:找不到Promise,Map,Set和Iterator

Angular:找不到Promise,Map,Set和Iterator

米琪卡哇伊 2019-09-20 15:28:17
安裝角之后,打字稿編譯器不斷收到一些錯誤約沒有找到Promise,Map,Set和Iterator。到現在為止我忽略了它們,但現在我需要Promise這樣我的代碼可以工作。import {Component} from 'angular2/core';@Component({    selector: 'greeting-cmp',    template: `<div>{{ asyncGreeting | async}}</div>`})export class GreetingCmp {    asyncGreeting: Promise<string> = new Promise(resolve => {// after 1 second, the promise will resolve        window.setTimeout(() => resolve('hello'), 1000);    });}Additional information:npm -v is 2.14.12node -v is v4.3.1typescript v is 1.6錯誤:................ERROS OF MY CODE.................    C:\Users\armyTik\Desktop\angular2\greeting_cmp.ts    Error:(7, 20) TS2304: Cannot find name 'Promise'.    Error:(7, 42) TS2304: Cannot find name 'Promise'.    .........................................    C:\Users\armyTik\Desktop\angular2\node_modules\angular2\platform\browser.d.ts    Error:(77, 90) TS2304: Cannot find name 'Promise'.    C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\application_ref.d.ts    Error:(83, 60) TS2304: Cannot find name 'Promise'.    Error:(83, 146) TS2304: Cannot find name 'Promise'.    Error:(96, 51) TS2304: Cannot find name 'Promise'.    Error:(96, 147) TS2304: Cannot find name 'Promise'.    Error:(133, 90) TS2304: Cannot find name 'Promise'.    Error:(171, 81) TS2304: Cannot find name 'Promise'.    C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\change_detection\parser\locals.d.ts    Error:(3, 14) TS2304: Cannot find name 'Map'.    Error:(4, 42) TS2304: Cannot find name 'Map'.    C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\debug\debug_node.d.ts    Error:(14, 13) TS2304: Cannot find name 'Map'.    Error:(24, 17) TS2304: Cannot find name 'Map'.    Error:(25, 17) TS2304: Cannot find name 'Map'.    C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\di\provider.d.ts    Error:(436, 103) TS2304: Cannot find name 'Map'.    Error:(436, 135) TS2304: Cannot find name 'Map'.
查看完整描述

3 回答

?
慕容3067478

TA貢獻1773條經驗 獲得超3個贊

我也有同樣的問題 - “未找到承諾” - 當代碼想要創(chuàng)建一個Promise對象時。


嘗試在stackoverflow上找到一些解決方案,包括取出System.config({...})以形成system.js并將其包含在index.html中的解決方案。


最后我解決了這個問題。問題是,在index.html中,包含了es6-shim.min.js。但是,在tsconfig.json中,“compilerOptions”下的“target”屬性的值為“es5”。在我將其更改為“es6”后,錯誤消失了。


查看完整回答
反對 回復 2019-09-20
?
一只甜甜圈

TA貢獻1836條經驗 獲得超5個贊

Angular 2決賽

- es5支持(與TS 2.0.0 +完美配合)

每次更新es6-shim不支持,現在,如果你有安裝在一起的兩條分型es6-shim和core-js在一起。es6-shim通過在tsconfig.json中提及刪除鍵入。您現在可以參考下面的core-js輸入以獲得es5支持main.ts


///<reference path="./../typings/globals/core-js/index.d.ts"/>

tsconfig.json


exclude: [

   "node_modules", //<-- this would be needed in case of VS2015

   "node_modules/@typings",

   "typings"

]

- es6 suppport

你只需要設置"target"屬性es6,然后所有將錯誤消失。并且轉換后的代碼將采用es6格式化。


查看完整回答
反對 回復 2019-09-20
  • 3 回答
  • 0 關注
  • 840 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號