Fix TSLint issues

This commit is contained in:
Fabio Berger
2018-05-14 21:48:46 +02:00
parent da60008048
commit 5422bf5733
9 changed files with 28 additions and 19 deletions

View File

@@ -6,7 +6,10 @@ import { DoneCallback } from '@0xproject/types';
const expect = chai.expect;
export const callbackErrorReporter = {
reportNoErrorCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
reportNoErrorCallbackErrors(
done: DoneCallback,
expectToBeCalledOnce: boolean = true,
): <T>(f?: ((value: T) => void) | undefined) => (value: T) => void {
const callback = <T>(f?: (value: T) => void) => {
const wrapped = (value: T) => {
if (_.isUndefined(f)) {
@@ -26,7 +29,10 @@ export const callbackErrorReporter = {
};
return callback;
},
reportNodeCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
reportNodeCallbackErrors(
done: DoneCallback,
expectToBeCalledOnce: boolean = true,
): <T>(f?: ((value: T) => void) | undefined) => (error: Error | null, value: T | undefined) => void {
const callback = <T>(f?: (value: T) => void) => {
const wrapped = (error: Error | null, value: T | undefined) => {
if (!_.isNull(error)) {
@@ -50,7 +56,10 @@ export const callbackErrorReporter = {
};
return callback;
},
assertNodeCallbackError(done: DoneCallback, errMsg: string) {
assertNodeCallbackError(
done: DoneCallback,
errMsg: string,
): <T>(error: Error | null, value: T | undefined) => void {
const wrapped = <T>(error: Error | null, value: T | undefined) => {
if (_.isNull(error)) {
done(new Error('Expected callback to receive an error'));