mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
+ changed promise declaration to own custom since it is not possible to reuse ES6 polyfill promise class declaration
This commit is contained in:
Vendored
+5
-5
@@ -35,11 +35,11 @@ declare module JSData {
|
||||
new(options?:DSHttpAdapterOptions):DSHttpAdapter;
|
||||
|
||||
// DSHttpAdapter uses axios so options are axios config objects.
|
||||
HTTP(options?:Object):Promise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url:string, data?:Object, options?:Object):Promise<DSHttpAdapterPromiseResolveType>;
|
||||
GET(url:string, data?:Object, options?:Object):Promise<DSHttpAdapterPromiseResolveType>;
|
||||
POST(url:string, data?:Object, options?:Object):Promise<DSHttpAdapterPromiseResolveType>;
|
||||
PUT(url:string, data?:Object, options?:Object):Promise<DSHttpAdapterPromiseResolveType>;
|
||||
HTTP(options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
DEL(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
GET(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
POST(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
PUT(url:string, data?:Object, options?:Object):JSDataPromise<DSHttpAdapterPromiseResolveType>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,9 @@ OtherOtherComment.find(5, {params: {postId: 4}}); // GET /post/4/comment/5
|
||||
|
||||
// vs
|
||||
|
||||
OtherOtherComment.find(5); // GET /comment/5
|
||||
var promise = OtherOtherComment.find(5); // GET /comment/5
|
||||
|
||||
promise.then().catch().finally();
|
||||
|
||||
OtherOtherComment.inject({id: 1, postId: 2});
|
||||
|
||||
|
||||
Vendored
+6
-8
@@ -3,12 +3,6 @@
|
||||
// Definitions by: Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Promises in js-data are ES6 polyfill promises
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <reference path="../es6-promise/es6-promise.d.ts" />
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// js-data module (js-data.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -16,10 +10,14 @@
|
||||
// defining what exists in JSData and how it looks
|
||||
declare module JSData {
|
||||
|
||||
interface JSDataPromise<R> extends Promise<R> {
|
||||
interface JSDataPromise<R> {
|
||||
|
||||
then<U>(onFulfilled?: (value: R) => U | JSDataPromise<U>, onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
catch<U>(onRejected?: (error: any) => U | JSDataPromise<U>): JSDataPromise<U>;
|
||||
|
||||
// enhanced with finally
|
||||
finally<U>(finallyCb?:() => U):Promise<U>;
|
||||
finally<U>(finallyCb?:() => U):JSDataPromise<U>;
|
||||
}
|
||||
|
||||
//TODO switch to class again when typescript supports open ended class declaration
|
||||
|
||||
Reference in New Issue
Block a user