Angular 5.0.2 confusing Promise class definitions in PhpStorm + ERROR on --prod

Viewed 228

I have an Angular app and using PhpStorm. After Updating to Angular 5 (via npm etc..) I have some confusing problems.

All Promise<MyClass> are marked as error cause "Promise is not generic"

On checking the Promise class I got the choice between an interface and a class inside an "index.d.ts". (in node_modules of Promises_es6 and @jquery) How ever both are generic.

I have obviously an error in my config. Can someone help me finding it?

Here are the configs:

package.json:

{
  "name": "my-site",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.1",
    "@angular/animations": "^5.0.1",
    "@angular/cdk": "^5.0.0-rc0",
    "@angular/common": "^5.0.1",
    "@angular/compiler": "^5.0.1",
    "@angular/core": "^5.0.1",
    "@angular/forms": "^5.0.1",
    "@angular/http": "^5.0.1",
    "@angular/material": "^5.0.0-rc0",
    "@angular/platform-browser": "^5.0.1",
    "@angular/platform-browser-dynamic": "^5.0.1",
    "@angular/router": "^5.0.1",
    "@types/es6-promise": "0.0.33",
    "ap-angular2-fullcalendar": "^1.3.5",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "^3.2.1",
    "material-design-icons": "^3.0.1",
    "rxjs": "^5.4.1",
    "zone.js": "^0.8.17"
  },
  "devDependencies": {
    "@angular/cli": "^1.5.2",
    "@angular/compiler-cli": "^5.0.1",
    "@angular/language-service": "^5.0.1",
    "@types/jasmine": "~2.6.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~8.0.51",
    "codelyzer": "~4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.2.0",
    "ts-node": "~3.3.0",
    "tslint": "~5.8.0",
    "typescript": "^2.4.2",
    "uglifyjs-webpack-plugin": "^1.0.1"
  }
}

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "ESNext", 
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

tsconfig.app.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

enter image description here

EDIT: Promise cause error on --prod build (dev build works)

After buildin --prod mode. Everything runs well. On accessing the site, the screen stays blank and this error appears in console:

main.3933c1a670523b7e59b4.bundle.js:1 ERROR TypeError: Cannot read property '_moduleDoBootstrap' of undefined
    at e.donePromise.then (main.3933c1a670523b7e59b4.bundle.js:1)
    at e.invoke (polyfills.20052382fb9ecf29cee5.bundle.js:1)
    at Object.onInvoke (main.3933c1a670523b7e59b4.bundle.js:1)
    at e.invoke (polyfills.20052382fb9ecf29cee5.bundle.js:1)
    at r.run (polyfills.20052382fb9ecf29cee5.bundle.js:1)
    at polyfills.20052382fb9ecf29cee5.bundle.js:1
    at e.invokeTask (polyfills.20052382fb9ecf29cee5.bundle.js:1)
    at Object.onInvokeTask (main.3933c1a670523b7e59b4.bundle.js:1)
    at e.invokeTask (polyfills.20052382fb9ecf29cee5.bundle.js:1)
    at r.runTask (polyfills.20052382fb9ecf29cee5.bundle.js:1)
(anonymous) @ main.3933c1a670523b7e59b4.bundle.js:1
handleError @ main.3933c1a670523b7e59b4.bundle.js:1
t.runOutsideAngular @ main.3933c1a670523b7e59b4.bundle.js:1
e.invoke @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.run @ polyfills.20052382fb9ecf29cee5.bundle.js:1
runOutsideAngular @ main.3933c1a670523b7e59b4.bundle.js:1
n.catch.n @ main.3933c1a670523b7e59b4.bundle.js:1
e.invoke @ polyfills.20052382fb9ecf29cee5.bundle.js:1
onInvoke @ main.3933c1a670523b7e59b4.bundle.js:1
e.invoke @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.run @ polyfills.20052382fb9ecf29cee5.bundle.js:1
(anonymous) @ polyfills.20052382fb9ecf29cee5.bundle.js:1
e.invokeTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
onInvokeTask @ main.3933c1a670523b7e59b4.bundle.js:1
e.invokeTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.runTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
o @ polyfills.20052382fb9ecf29cee5.bundle.js:1
Promise resolved (async)
r @ polyfills.20052382fb9ecf29cee5.bundle.js:1
e.scheduleTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
onScheduleTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
e.scheduleTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.scheduleTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.scheduleMicroTask @ polyfills.20052382fb9ecf29cee5.bundle.js:1
c @ polyfills.20052382fb9ecf29cee5.bundle.js:1
e.then @ polyfills.20052382fb9ecf29cee5.bundle.js:1
appInitializer @ main.3933c1a670523b7e59b4.bundle.js:1
runInitializers @ main.3933c1a670523b7e59b4.bundle.js:1
n @ main.3933c1a670523b7e59b4.bundle.js:1
(anonymous) @ main.3933c1a670523b7e59b4.bundle.js:1
n.run @ main.3933c1a670523b7e59b4.bundle.js:1
e.invoke @ polyfills.20052382fb9ecf29cee5.bundle.js:1
onInvoke @ main.3933c1a670523b7e59b4.bundle.js:1
e.invoke @ polyfills.20052382fb9ecf29cee5.bundle.js:1
r.run @ polyfills.20052382fb9ecf29cee5.bundle.js:1
run @ main.3933c1a670523b7e59b4.bundle.js:1
bootstrapModuleFactory @ main.3933c1a670523b7e59b4.bundle.js:1
cDNt @ main.3933c1a670523b7e59b4.bundle.js:1
n @ inline.81a18cab7f77e5e3b05a.bundle.js:1
0 @ main.3933c1a670523b7e59b4.bundle.js:1
n @ inline.81a18cab7f77e5e3b05a.bundle.js:1
window.webpackJsonp @ inline.81a18cab7f77e5e3b05a.bundle.js:1
(anonymous) @ main.3933c1a670523b7e59b4.bundle.js:1
main.3933c1a670523b7e59b4.bundle.js:1 ERROR Error: Uncaught (in promise): TypeError: Cannot read property '_moduleDoBootstrap' of undefined
TypeError: Cannot read property '_moduleDoBootstrap' of undefined
    at e.donePromise.then (main.3933c1a670523b7e59b4.bundle.js:1)
...
1 Answers

Since there seems no good idea to that problem and angular 5 still makes many problems, I reset to version 4.4.4 and everything runs smooth again.

Related