0

I have been through the boards and tried to find the solution to my problem. My code is building and running but when trying to include some Internationalisation I get typescript errors.

When running this command

ng-xi18n --i18nFormat=xlf

I get the following

Error: Error at ...node_modules/rxjs/Observable.d.ts:68:60: Cannot find name 'Promise'.
Error at ...node_modules/rxjs/Observable.d.ts:68:70: Cannot find name 'Promise'.
Error at ...node_modules/@angular/core/src/application_init.d.ts:21:27: Cannot find name 'Promise'.
Error at ...node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts:15:48: Cannot find name 'Iterable'.
Error at ...node_modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts:28:32: Cannot find name 'Iterable'.
Error at ...node_modules/@angular/core/src/linker/compiler.d.ts:43:49: Cannot find name 'Promise'.
Error at ...node_modules/@angular/core/src/linker/compiler.d.ts:51:65: Cannot find name 'Promise'.
Error at ...node_modules/@angular/core/src/application_ref.d.ts:116:76: Cannot find name 'Promise'.

I have tried a bunch of things but my files look like this

tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  }
}

I ran the typings update which looked promising but saw the same result.

npm install --save-dev typings -g

$(npm bin)/typings install --global --save dt~core-js

tsc --rootDir src --outDir dist <-- this line just showed the help


Below is part of the package.json file

"dependencies": {
    "@angular/common": "~4.2.4",
    "@angular/compiler": "~4.2.4",
    "@angular/core": "~4.2.4",
    "@angular/forms": "~4.2.4",
    "@angular/http": "~4.2.4",
    "@angular/platform-browser": "~4.2.4",
    "@angular/platform-browser-dynamic": "~4.2.4",
    "@angular/router": "~4.2.4",

    "angular-in-memory-web-api": "~0.3.0",
    "systemjs": "0.19.40",
    "core-js": "^2.4.1",
    "rxjs": "5.0.1",
    "zone.js": "^0.8.4"
},

"devDependencies": {
    "@angular/compiler-cli": "~4.2.4",
    "@angular/platform-server": "~4.2.4",
    "@angular/animations": "~4.2.4",

    "concurrently": "^3.2.0",
    "lite-server": "^2.2.2",
    "typescript": "~2.1.0",

    "canonical-path": "0.0.2",
    "tslint": "^3.15.1",
    "lodash": "^4.16.4",
    "jasmine-core": "~2.4.1",
    "karma": "^1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~4.0.14",
    "rimraf": "^2.5.4",

    "@types/core-js": "~0.9.42",
    "@types/node": "^6.0.46",
    "@types/jasmine": "2.5.36",

    "typings": "~2.1.1"
}
Matt
  • 487
  • 1
  • 6
  • 16
  • Try installing es6-shim typings. – Deepthi S Jun 29 '17 at 09:38
  • Thanks Deepthi, I am actually only using angular and typescript for first time last 2 days. What would I do after installing es6-shim typings? Or how would I go about installing es6-shim typings? – Matt Jun 29 '17 at 09:43
  • You can install using this command- typings install --global dt~es6-shim – Deepthi S Jun 29 '17 at 09:56
  • okay thanks, I thought there would be something more to it than that after i installed it – Matt Jun 29 '17 at 10:09
  • I would say you should go for @types instead, if you have both, you will get those kind of errors – Alejandro Lora Jun 29 '17 at 10:10
  • added my current package.json file – Matt Jun 29 '17 at 10:23
  • As AlejandroLora says, remove typings and only use @types, related: https://stackoverflow.com/questions/39261204/typings-vs-types-npm-scope – Bulan Jun 29 '17 at 10:40
  • so I took typings out of the project.json. Deleted the node_modules folder. "npm install" then "npm run i18n:extract" but the same errors – Matt Jun 29 '17 at 13:34

0 Answers0