Skip to content

Commit

Permalink
Clean up a thing of two.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pimm committed Nov 25, 2021
1 parent a742fb0 commit a43e7e8
Show file tree
Hide file tree
Showing 5 changed files with 1,764 additions and 1,823 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
"@types/jest": "^26.0.24",
"@types/lodash": "^4.14.172",
"@types/node": "^16.4.11",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"axios-mock-adapter": "^1.19.0",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"axios-mock-adapter": "1.19.0",
"babel-jest": "^27.0.6",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "24.9.0",
"jest-bluster": "^1.0.1",
"nock": "^13.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/binders/chargebacks/ChargebacksBinder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TransformingNetworkClient from '../../communication/TransformingNetworkClient';
import Chargeback, { ChargebackData, transform } from '../../data/chargebacks/Chargeback';
import Chargeback, { ChargebackData } from '../../data/chargebacks/Chargeback';
import List from '../../data/list/List';
import HelpfulIterator from '../../plumbing/HelpfulIterator';
import renege from '../../plumbing/renege';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TransformingNetworkClient from '../../../communication/TransformingNetworkClient';
import Chargeback, { ChargebackData, transform } from '../../../data/chargebacks/Chargeback';
import Chargeback, { ChargebackData } from '../../../data/chargebacks/Chargeback';
import List from '../../../data/list/List';
import ApiError from '../../../errors/ApiError';
import checkId from '../../../plumbing/checkId';
Expand Down
10 changes: 6 additions & 4 deletions src/communication/TransformingNetworkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ export default class TransformingNetworkClient {
}.bind(this);
}

async post<R extends Model<any, any>, U extends any>(...passingArguments: Parameters<NetworkClient['post']>) {
async post<R extends Model<any, any>, U>(...passingArguments: Parameters<NetworkClient['post']>) {
const response = await this.networkClient.post<R>(...passingArguments);
if (response == true) {
return true as U;
// (If the response is true, it is assumed that the U type variable is true.)
return true as unknown as U;
}
return this.transform(response) as U;
}
Expand All @@ -61,10 +62,11 @@ export default class TransformingNetworkClient {
return this.networkClient.patch<R>(...passingArguments).then(this.transform) as Promise<U>;
}

async delete<R extends Model<any, any>, U extends any>(...passingArguments: Parameters<NetworkClient['delete']>) {
async delete<R extends Model<any, any>, U>(...passingArguments: Parameters<NetworkClient['delete']>) {
const response = await this.networkClient.delete<R>(...passingArguments);
if (response == true) {
return true as U;
// (If the response is true, it is assumed that the U type variable is true.)
return true as unknown as U;
}
return this.transform(response) as U;
}
Expand Down
Loading

0 comments on commit a43e7e8

Please sign in to comment.