1

I have updated my angular2 to the current release but I got the following errors: It seems there's an issue in the jasmine index file.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:40:37 A parameter initializer is only allowed in a function or constructor implementation.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:40:45 Cannot find name 'keyof'.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:40:51 '=' expected.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:42:45 A parameter initializer is only allowed in a function or constructor implementation.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:42:55 Cannot find name 'keyof'.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:42:61 '=' expected.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:58:41 Cannot find name 'Partial'.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:99:21 Cannot find name 'Partial'.

ERROR in [default] C:\src\Angular2\BuyPracticeTest_AV4\node_modules\@types\jasmine\index.d.ts:99:34 Cannot find name 'Partial'.

Here's my package.json file:

{
  "name": "buy-practice-test",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.10",
    "@angular/compiler": "^2.4.10",
    "@angular/core": "^2.4.10",
    "@angular/forms": "^2.4.10",
    "@angular/http": "^2.4.10",
    "@angular/platform-browser": "^2.4.10",
    "@angular/platform-browser-dynamic": "^2.4.10",
    "@angular/router": "^3.4.10",
    "angular2-datatable": "^0.5.3",
    "core-js": "^2.4.1",
    "ng2-pagination": "^0.5.1",
    "ng2-table": "^1.3.2",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "^2.5.47",
    "@types/node": "^6.0.68",
    "angular-cli": "1.0.0-beta.18",
    "codelyzer": "1.0.0-beta.1",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "~2.0.3"
  }
}

1 Answer 1

1

keyof was introduced in Typescript 2.1, and in your package.json I see Typescript 2.0.3.

Unfortunately, there is a dependency on typescript 2.0.10 by @angular-cli/[email protected], so you might not be able to upgrade to the latest typescript version (2.2.2). However, you may be able to downgrade jasmine or @types/jasmine.

I recommend that you upgrade in smaller steps. i.e. use npm outdated to see what version you can upgrade to based on all your dependencies. Upgrade a few libraries at a time - periodically check to make sure you haven't broken anything. After you've upgraded what you can, next upgrade @angular to 4.0.

Sign up to request clarification or add additional context in comments.

3 Comments

I have updated Typescript to 2.2.2 but I got another error. Module build failed: TypeError: Cannot read property 'exclude' of undefined at applyDefaults \awesome-typescript-loader\src\instance.ts:266:72) at Object.ensureInstance
Sorry, I've updated my post. I suggest you update incrementally. I think that based on angular-cli, you can only upgrade to [email protected]. Start from the beginning again, and use npm outdated
it works now. thanks a lot!. I have updated everything manually.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.