From f8d7eee419e88a7f20c1144fef1843e8b71801dc Mon Sep 17 00:00:00 2001 From: Scott McArthur Date: Sun, 16 Mar 2014 17:15:47 +0000 Subject: [PATCH] Added new() to IResourceClass Added `new(dataOrParams? : any) : T;` to `IResourceClass` to allow creation of a new instance of the resource using the `new` keyword, which is required to create a new resource object of type `T`. In the [AngularJS documentation example](http://docs.angularjs.org/api/ngResource/service/$resource) this change would allow for line 27 `new CreditCard({number:'0123'});` where `CreditCard` is `IResourceClass`. Without this change we get `error TS2083: Invalid 'new' expression.` when new-ing the resource. --- angularjs/angular-resource.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 0317e17b7a..a0cd4ab85a 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -51,6 +51,7 @@ declare module ng.resource { // to be considered as parameters to the request. // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 interface IResourceClass { + new(dataOrParams? : any) : T; get(): T; get(dataOrParams: any): T; get(dataOrParams: any, success: Function): T;