Error TS2345 Argument of type '{ selector: string; template: string; }' is not assignable to parameter of type '_ComponentArg'.

1,749 views
Skip to first unread message

Theo

unread,
Nov 25, 2015, 5:40:40 PM11/25/15
to AngularJS
OS: Windows 10 Pro
IDE: Visual Studio 2015 (Community)

So, I'm attempting to run the '5 Minute Quickstart' angular 2 for typescript demo, as documented at https://angular.io/docs/ts/latest/quickstart.html, in Visual Studio and am getting the following error message:

"Error TS2345  Argument of type '{ selector: string; template: string; }' is not assignable to parameter of type '_ComponentArg'.
  Object literal may only specify known properties, and 'template' does not exist in type '_ComponentArg'. "

As can be seen in the right hand pane of the attached image, the Angular2 definition file is included in the project.

What is the issue here, and how do I resolve it?

Many thanks in advance,
Theo
Angular2 TypeScript 1.6 Error TS2345.jpg

Eric Martinez

unread,
Nov 25, 2015, 7:39:07 PM11/25/15
to AngularJS
It looks like you are using an old version of angular2. 

Did you run these commands?
  1. npm init -y
  2. npm i angular2@2.0.0-alpha.44 systemjs@0.19.2 --save --save-exact
  3. npm i typescript live-server --save-dev

Change alpha.44 to alpha.46 and the typings should work. Related to typings, you probably should read this issue https://github.com/angular/angular/issues/5248

Theo

unread,
Nov 26, 2015, 7:42:39 AM11/26/15
to AngularJS
OS: Windows 10 Pro
IDE: Visual Studio 2015 Community
NPM version: 1.4.28

So, I run the following line:

"npm i angu...@2.0.0-alpha.44 syst...@0.19.2 --save --save-exact"

and a node_modules folder is created, in the root of my project, inside which systemjs and angular2 are created. .

But then inexplicably the angular2 folder will suddenly disappear from the node_modules folder! Any time the package.json file is amended in Visual Studio, as shown in the attached image, the folder structure is recreated, but then the angular2 folder disappears again

What is the issue here?


Many thanks in advance,
Theo

Angular2 TypeScript 1.6 Error TS2345 - 2.jpg

Theo

unread,
Nov 27, 2015, 10:10:29 AM11/27/15
to AngularJS
OS: Windows 10 Pro
IDE: Visual Studio 2015 Community
NPM version: 1.4.28

Further to the following post, and as shown in the attached image, npm i angu...@2.0.0-alpha.44 fails completely.


What is the issue here?

Many thanks in advance,
Theo

npm angular2 error.jpg

Eric Martinez

unread,
Nov 27, 2015, 11:04:04 AM11/27/15
to AngularJS
Those are really old versions of both node and npm

My current versions 

- node v4.2.1
- npm v2.14.7

Those versions are the minimal recommended by the Developer guide
Reply all
Reply to author
Forward
0 new messages