Which @angular/forms version for angular 2 RC7?

2019-09-04 05:23发布

问题:

I'm in the process of upgrading an Angular 2 app from RC5 to RC7. @angular/forms package version is 0.3.0, and I could not find a newer one.

Still, in 2.0.0-rc.6 the Type declaration was deprecated in favour of Type<T>. But it looks like forms package needs to be updated, as now when building I got a bunch of errors like:

ERROR in [default] path/to/my/project/node_modules/@angular/forms/src/directives.d.ts:26:45 Generic type 'Type' requires 1 type argument(s).

Does anyone know if there's a newer version of forms package? By listing with npm show @angular/forms@* version it seems not:

@angular/forms@0.1.0 '0.1.0'
@angular/forms@0.1.1 '0.1.1'
@angular/forms@0.2.0 '0.2.0'
@angular/forms@0.3.0 '0.3.0'

Is there any other workaround? Although being all release candidates, it seems strange that such a crucial package has been left behind for 2 RC versions.

TA

回答1:

Make sure with RC7 you have following package.json file

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.7",
    "@angular/compiler": "2.0.0-rc.7",
    "@angular/core": "2.0.0-rc.7",
    "@angular/forms": "2.0.0-rc.7",
    "@angular/http": "2.0.0-rc.7",
    "@angular/platform-browser": "2.0.0-rc.7",
    "@angular/platform-browser-dynamic": "2.0.0-rc.7",
    "@angular/router": "3.0.0-rc.3",
    "@angular/upgrade": "2.0.0-rc.7",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.21",
    "angular2-in-memory-web-api": "0.0.19",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.2.0",
    "lite-server": "^2.2.2",
    "typescript": "^1.8.10",
    "typings":"^1.3.2"
  }
}