Depois de instalar Angular, o compilador manter Typescript recebendo alguns erros em não encontrar Promise
, Map
, Set
e Iterator
.
Até agora eu os ignorei, mas agora preciso Promise
para que meu código funcione.
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.12
node -v is v4.3.1
typescript v is 1.6
Os erros:
................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'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\linker\compiler.d.ts
Error:(12, 50) TS2304: Cannot find name 'Promise'.
Error:(16, 41) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\linker\dynamic_component_loader.d.ts
Error:(108, 136) TS2304: Cannot find name 'Promise'.
Error:(156, 150) TS2304: Cannot find name 'Promise'.
Error:(197, 128) TS2304: Cannot find name 'Promise'.
Error:(203, 127) TS2304: Cannot find name 'Promise'.
Error:(204, 141) TS2304: Cannot find name 'Promise'.
Error:(205, 119) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\core\render\api.d.ts
Error:(13, 13) TS2304: Cannot find name 'Map'.
Error:(14, 84) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\facade\async.d.ts
Error:(27, 33) TS2304: Cannot find name 'Promise'.
Error:(28, 45) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\facade\collection.d.ts
Error:(1, 25) TS2304: Cannot find name 'MapConstructor'.
Error:(2, 25) TS2304: Cannot find name 'SetConstructor'.
Error:(4, 27) TS2304: Cannot find name 'Map'.
Error:(4, 39) TS2304: Cannot find name 'Map'.
Error:(7, 9) TS2304: Cannot find name 'Map'.
Error:(8, 30) TS2304: Cannot find name 'Map'.
Error:(11, 43) TS2304: Cannot find name 'Map'.
Error:(12, 27) TS2304: Cannot find name 'Map'.
Error:(14, 23) TS2304: Cannot find name 'Map'.
Error:(15, 25) TS2304: Cannot find name 'Map'.
Error:(95, 41) TS2304: Cannot find name 'Set'.
Error:(96, 22) TS2304: Cannot find name 'Set'.
Error:(97, 25) TS2304: Cannot find name 'Set'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\facade\lang.d.ts
Error:(13, 17) TS2304: Cannot find name 'Map'.
Error:(14, 17) TS2304: Cannot find name 'Set'.
Error:(78, 59) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\facade\promise.d.ts
Error:(2, 14) TS2304: Cannot find name 'Promise'.
Error:(7, 32) TS2304: Cannot find name 'Promise'.
Error:(8, 38) TS2304: Cannot find name 'Promise'.
Error:(9, 35) TS2304: Cannot find name 'Promise'.
Error:(9, 93) TS2304: Cannot find name 'Promise'.
Error:(10, 34) TS2304: Cannot find name 'Promise'.
Error:(11, 32) TS2304: Cannot find name 'Promise'.
Error:(11, 149) TS2304: Cannot find name 'Promise'.
Error:(12, 43) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\http\headers.d.ts
Error:(43, 59) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\http\url_search_params.d.ts
Error:(11, 16) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\platform\browser\browser_adapter.d.ts
Error:(75, 33) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\angular2\src\platform\dom\dom_adapter.d.ts
Error:(85, 42) TS2304: Cannot find name 'Map'.
C:\Users\armyTik\Desktop\angular2\node_modules\rxjs\CoreOperators.d.ts
Error:(35, 67) TS2304: Cannot find name 'Promise'.
Error:(50, 66) TS2304: Cannot find name 'Promise'.
Error:(89, 67) TS2304: Cannot find name 'Promise'.
Error:(94, 38) TS2304: Cannot find name 'Promise'.
Error:(94, 50) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\rxjs\Observable.d.ts
Error:(46, 62) TS2304: Cannot find name 'Promise'.
Error:(47, 42) TS2304: Cannot find name 'Iterator'.
Error:(103, 74) TS2304: Cannot find name 'Promise'.
Error:(103, 84) TS2304: Cannot find name 'Promise'.
Error:(143, 66) TS2304: Cannot find name 'Promise'.
Error:(158, 65) TS2304: Cannot find name 'Promise'.
Error:(201, 66) TS2304: Cannot find name 'Promise'.
Error:(206, 38) TS2304: Cannot find name 'Promise'.
Error:(206, 50) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\rxjs\observable\ForkJoinObservable.d.ts
Error:(6, 50) TS2304: Cannot find name 'Promise'.
Error:(7, 58) TS2304: Cannot find name 'Promise'.
C:\Users\armyTik\Desktop\angular2\node_modules\rxjs\observable\FromObservable.d.ts
Error:(7, 38) TS2304: Cannot find name 'Promise'.
Error:(7, 51) TS2304: Cannot find name 'Iterator'.
C:\Users\armyTik\Desktop\angular2\node_modules\rxjs\observable\PromiseObservable.d.ts
Error:(9, 31) TS2304: Cannot find name 'Promise'.
Error:(10, 26) TS2304: Cannot find name 'Promise'.