Neil
Neil

Reputation: 2749

Angular2, ASP.NET 5 project setup. "Type expected" error on di.d.ts

I am trying to get familiar with Angular2, TypeScript and ASP.NET 5. I am not very familiar with any of them so am following this tutorial:

https://www.youtube.com/watch?v=Zkesm9CUP_o&feature=youtu.be

My problem is that once I try to import from 'angular2/angular2' I am getting a build error in one of the Angular2 Typescript files.

So here is my folder structure:

enter image description here

Here is tsconfig.json

enter image description here

Here is gulpfile.js

enter image description here

and app.ts just contains the following:

import { Component, View, bootstrap } from 'angular2/angular2';

When I try to build, I get an error in di.d.ts. this is located in src\node_modules\angular2\src\core\metadata\di.d.ts

This is the error:

Error TS1110
Build: Type expected.

This is the line that the error refers to:

enter image description here

Any ideas why I'm getting this?

Upvotes: 1

Views: 2063

Answers (1)

m1kael
m1kael

Reputation: 2851

Looks like there's an error in the type definition file. Change

token: this;

to

token: AttributeMetadata;

and it should compile.

EDIT: This is indeed a feature, as @Eric Martinez commented, called "Polymorphic this Typing". Updating to TypeScript 1.7+ fixes the issue.

Upvotes: 1

Related Questions