diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 9d5aa9fb4..11d7a086d 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -22,7 +22,7 @@ myApp.config((RestangularProvider: restangular.IProvider) => { RestangularProvider.setRequestInterceptor(function (element, operation, route, url) { }); - RestangularProvider.addElementTransformer('accounts', false, function (elem) { + RestangularProvider.addElementTransformer('accounts', false, function (elem: any) { elem.accountName = 'Changed'; return elem; }); @@ -74,9 +74,13 @@ myApp.controller('TestCtrl', ( baseAccounts.post(newAccount); Restangular.allUrl('googlers', 'http://www.google.com/').getList(); + Restangular.allUrl('googlers', 'http://www.google.com/').getList(); Restangular.oneUrl('googlers', 'http://www.google.com/1').get(); + Restangular.oneUrl('googlers', 'http://www.google.com/1').get(); Restangular.one('accounts', 123).one('buildings', 456).get(); + Restangular.one('accounts', 123).one('buildings', 456).get(); Restangular.one('accounts', 123).getList('buildings'); + Restangular.one('accounts', 123).getList('buildings'); baseAccounts.getList().then(function (accounts) { var firstAccount = accounts[0]; @@ -104,7 +108,7 @@ myApp.controller('TestCtrl', ( console.log("There was an error saving"); }); - firstAccount.getList("users", {query: "params"}).then(function(users) { + firstAccount.getList("users", {query: "params"}).then(function(users: any) { users.post({userName: 'unknown'}); users.customGET("messages", {param: "myParam"}); @@ -151,7 +155,7 @@ myApp.controller('TestCtrl', ( configurer.setRequestInterceptor(function (element, operation, route, url) { }); - configurer.addElementTransformer('accounts', false, function (elem) { + configurer.addElementTransformer('accounts', false, function (elem: any) { elem.accountName = 'Changed'; return elem; }); diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index a1a7e8a5e..8b8fd9d2f 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -99,10 +99,14 @@ declare module restangular { interface IElement extends IService { get(queryParams?: any, headers?: any): IPromise; + get(queryParams?: any, headers?: any): IPromise; getList(subElement?: any, queryParams?: any, headers?: any): ICollectionPromise; + getList(subElement?: any, queryParams?: any, headers?: any): ICollectionPromise; put(queryParams?: any, headers?: any): IPromise; post(subElement: any, elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(subElement: any, elementToPost: T, queryParams?: any, headers?: any): IPromise; post(elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(elementToPost: T, queryParams?: any, headers?: any): IPromise; remove(queryParams?: any, headers?: any): IPromise; head(queryParams?: any, headers?: any): IPromise; trace(queryParams?: any, headers?: any): IPromise; @@ -114,7 +118,9 @@ declare module restangular { interface ICollection extends IService { getList(queryParams?: any, headers?: any): ICollectionPromise; + getList(queryParams?: any, headers?: any): ICollectionPromise; post(elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(elementToPost: T, queryParams?: any, headers?: any): IPromise; head(queryParams?: any, headers?: any): IPromise; trace(queryParams?: any, headers?: any): IPromise; options(queryParams?: any, headers?: any): IPromise;