diff --git a/superagent/superagent-tests.ts b/superagent/superagent-tests.ts
index 58b6840440..d61e411c85 100644
--- a/superagent/superagent-tests.ts
+++ b/superagent/superagent-tests.ts
@@ -279,3 +279,9 @@ request
.attach('image', 'path/to/tobi.png')
.on('error', (err: any) => {})
.end(callback);
+
+//Promise
+request
+ .get('/search')
+ .then((response) => {})
+ .catch((error) => {});
\ No newline at end of file
diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts
index d16b13584f..6217809a85 100644
--- a/superagent/superagent.d.ts
+++ b/superagent/superagent.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for SuperAgent v1.4.0
+// Type definitions for SuperAgent v2.0.0
// Project: https://github.com/visionmedia/superagent
// Definitions by: Alex Varju
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -80,7 +80,7 @@ declare module "superagent" {
get(header: string): string;
}
- interface Request /* extends NodeJS.WritableStream */ {
+ interface Request extends Promise /* extends NodeJS.WritableStream */ {
abort(): void;
accept(type: string): this;
attach(field: string, file: string, filename?: string): this;
diff --git a/supertest-as-promised/supertest-as-promised.d.ts b/supertest-as-promised/supertest-as-promised.d.ts
index c16be4cb97..89bc3e5525 100644
--- a/supertest-as-promised/supertest-as-promised.d.ts
+++ b/supertest-as-promised/supertest-as-promised.d.ts
@@ -22,7 +22,7 @@ declare module "supertest-as-promised" {
interface Response extends supertest.Response {
}
- interface Test extends Promise, supertest.Test, supersgent.Request {
+ interface Test extends supertest.Test, supersgent.Request {
toPromise(): PromiseBlurbird;
}
@@ -33,27 +33,4 @@ declare module "supertest-as-promised" {
}
export = supertestAsPromised
- // from core-js.d.ts
- /**
- * Represents the completion of an asynchronous operation
- */
- interface Promise {
- /**
- * Attaches callbacks for the resolution and/or rejection of the Promise.
- * @param onfulfilled The callback to execute when the Promise is resolved.
- * @param onrejected The callback to execute when the Promise is rejected.
- * @returns A Promise for the completion of which ever callback is executed.
- */
- then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise;
- then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise;
-
- /**
- * Attaches a callback for only the rejection of the Promise.
- * @param onrejected The callback to execute when the Promise is rejected.
- * @returns A Promise for the completion of the callback.
- */
- catch(onrejected?: (reason: any) => T | PromiseLike): Promise;
- catch(onrejected?: (reason: any) => void): Promise;
- }
-
}