Skip to content

Commit

Permalink
fix(error): wrong return type
Browse files Browse the repository at this point in the history
  • Loading branch information
yisraelx committed Mar 17, 2018
1 parent 1c622c0 commit 2b6ba1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/error/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ declare module '@promises/core' {
* });
* ```
*/
error(this: Promises<T>, value: any): Promises<any>;
error(this: Promises<T>, newValue: any): Promises<never>;
}
}
8 changes: 4 additions & 4 deletions modules/error/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import { IOptionalPromise } from '@promises/interfaces';
* });
* ```
*/
function error(promise: IOptionalPromise<any>, value: any): Promise<any> {
return Promise.resolve(promise).then(() => {
throw value;
}) as Promise<any>;
function error(value: IOptionalPromise<any>, newValue: any): Promise<never> {
return Promise.resolve(value).then(() => {
throw newValue;
});
}

export default error;

0 comments on commit 2b6ba1c

Please sign in to comment.