Skip to content

Commit

Permalink
fix typescript config
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicMahieu committed Oct 14, 2019
1 parent 4758548 commit 2eccdf4
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class DirectCashbackResolver {
...input.toOmnipartners(),
user_guid,
});
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ConnectionArgs } from "../connections";
import { Context } from "../types/Context";
import { PartnerConnection, PartnerListItem } from "./PartnerListItem";

@Resolver(of => PartnerListItem)
@Resolver(() => PartnerListItem)
export class PartnerListItemResolver {
@Query(() => PartnerConnection, { nullable: true })
public async partnerList(
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql-schema/src/resolvers/DealResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class DealResolver {
code,
deal_ref,
});
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand All @@ -125,6 +126,7 @@ export class DealResolver {
...input,
user_guid,
});
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
IRegisterUserAddressInput,
IUpdateUserAddressInput,
} from "omnipartners";
import { IUpdateUserAddressInput } from "omnipartners";
import { Arg, Ctx, Field, InputType, Mutation, Resolver } from "type-graphql";
import { Context } from "../types/Context";
import { GenericValidationError } from "../types/GenericValidationError";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ export class UserPartnerRelationCreateResolver {
): Promise<UserPartnerUpdateResult> {
const { user_guid } = ctx.userTokenHelper.parse(token);
try {
const partners = (await ctx.omnipartners.identity.createPartnerAccountRelation(
{
...mapClixrayFields(userPartnerInput),
user_guid,
},
)).data;
await ctx.omnipartners.identity.createPartnerAccountRelation({
...mapClixrayFields(userPartnerInput),
user_guid,
});

const user = await ctx.omnipartners.identity.authenticateByGUID({
data_options: userDataOptions,
Expand Down
10 changes: 9 additions & 1 deletion packages/graphql-schema/src/user/UserResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Resolver,
} from "type-graphql";
import { Context } from "../types/Context";
import { GenericError, handleGeneric } from "../types/GenericResult";
import { GenericError } from "../types/GenericResult";
import { GenericValidationError } from "../types/GenericValidationError";
import { User } from "./User";
import { UserResult } from "./UserResult";
Expand Down Expand Up @@ -142,6 +142,7 @@ export class UserResolver {
value,
ttl,
});
return;
} catch (err) {
return new GenericError(err);
}
Expand Down Expand Up @@ -177,6 +178,7 @@ export class UserResolver {
await ctx.omnipartners.identity.recoverPassword({
uid: email,
});
return;
} catch (err) {
return new GenericError(err);
}
Expand All @@ -198,6 +200,7 @@ export class UserResolver {
: confirmLegalFormsInput.legal_form_code,
user_guid,
});
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand All @@ -220,6 +223,7 @@ export class UserResolver {
};
try {
await ctx.omnipartners.identity.updateSubscriptions(data);
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand All @@ -239,6 +243,7 @@ export class UserResolver {
place_id: updatePlacesOfPurchaseInput.place_id,
user_guid,
});
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand All @@ -249,6 +254,7 @@ export class UserResolver {
};
try {
await ctx.omnipartners.identity.updateUserPlacesOfPurchase(data);
return;
} catch (err) {
return new GenericValidationError(err);
}
Expand All @@ -264,6 +270,7 @@ export class UserResolver {
await ctx.omnipartners.identity.forceActivate({
user_guid: guid,
});
return;
} catch (err) {
return new GenericError(err);
}
Expand All @@ -279,6 +286,7 @@ export class UserResolver {
await ctx.omnipartners.identity.confirmUserAccount({
identifier: user_guid,
});
return;
} catch (err) {
return new GenericError(err);
}
Expand Down
11 changes: 1 addition & 10 deletions packages/graphql-schema/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../../tsconfig.json",
"include": ["src"],
"exclude": ["node_modules"],
"compilerOptions": {
Expand All @@ -9,16 +10,6 @@
"target": "es2016",
"esModuleInterop": true,
"declaration": true,

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"strictFunctionTypes": true, /* Enable strict checking of function types. */
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

"types": [
"@types/jest"
]
Expand Down
4 changes: 2 additions & 2 deletions packages/omnipartners/src/lib/apiDecorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const doc = (url: string) => (target: any, property: string) => {

export function filterInput(allowKeys: string[]) {
return (
target: any,
property: string,
_: any,
_2: string,
descriptor: TypedPropertyDescriptor<(data: any) => any>,
) => {
const fn = descriptor.value;
Expand Down
4 changes: 2 additions & 2 deletions packages/omnipartners/src/tests/test.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ afterEach(() => {
});

export function withArguments(data: any, { shouldThrow = false } = {}) {
return (target: any, property: string, descriptor: any) => {
return (_: any, _2: string, descriptor: any) => {
const fn = descriptor.value;
descriptor.value = async function() {
const api = new this.Api(this.apiConfig);
Expand Down Expand Up @@ -52,7 +52,7 @@ export function withMock({
reply?: any;
delay?: { head?: number };
}) {
return (target: any, property: string, descriptor: any) => {
return (_: any, _2: string, descriptor: any) => {
const fn = descriptor.value;
descriptor.value = async function(...args: any[]) {
const {
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
Expand Down

0 comments on commit 2eccdf4

Please sign in to comment.