Skip to content

Commit eea0336

Browse files
committed
chore(functions): remove unnecessary type assertions
Auto-fix from eslint --fix to clear pre-existing @typescript-eslint/no-unnecessary-type-assertion errors that were failing CI.
1 parent 7dba1f9 commit eea0336

10 files changed

Lines changed: 14 additions & 16 deletions

File tree

functions/src/admin-match-requests-api/plugins/admin-match-requests-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function createAdminMatchRequestsPlugin(services?: PartialServices) {
8585
logger,
8686
set,
8787
}) => {
88-
const typedBody = body as { sent: boolean };
88+
const typedBody = body;
8989
return updateMatchRequestLogic({
9090
requestId: params.requestId,
9191
sent: typedBody.sent,

functions/src/admin-members-api/plugins/admin-members-plugin.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Elysia } from "elysia";
22
import { logger as firebaseLogger } from "firebase-functions/v2";
3-
import type { ProfileDataBody } from "../../profiles-api/schemas/profile-schemas.js";
43
import { ProfileDataBodySchema } from "../../profiles-api/schemas/profile-schemas.js";
54
import { AuthService } from "../../shared-api/services/auth/index.js";
65
import { EmailService } from "../../shared-api/services/email/index.js";
@@ -254,7 +253,7 @@ export function createAdminMembersPlugin(services?: PartialServices) {
254253
logger,
255254
set,
256255
}) => {
257-
const typedBody = body as ProfileDataBody;
256+
const typedBody = body;
258257
return updateProfileLogic({
259258
memberId: params.memberId,
260259
profileData: typedBody,
@@ -280,7 +279,7 @@ export function createAdminMembersPlugin(services?: PartialServices) {
280279
logger,
281280
set,
282281
}) => {
283-
const typedBody = body as { slug: string };
282+
const typedBody = body;
284283
return linkProfileLogic({
285284
memberId: params.memberId,
286285
slug: typedBody.slug,
@@ -366,7 +365,7 @@ export function createAdminMembersPlugin(services?: PartialServices) {
366365
logger,
367366
set,
368367
}) => {
369-
const typedBody = body as { newExpirationDate: string };
368+
const typedBody = body;
370369
return extendMembershipLogic({
371370
memberId: params.memberId,
372371
newExpirationDate: typedBody.newExpirationDate,
@@ -423,7 +422,7 @@ export function createAdminMembersPlugin(services?: PartialServices) {
423422
logger,
424423
set,
425424
}) => {
426-
const typedBody = body as { admin?: boolean };
425+
const typedBody = body;
427426
return updateClaimsLogic({
428427
uid: params.memberId,
429428
claims: typedBody,

functions/src/admin-members-api/routes/approve-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ export async function approveProfileLogic({
4747
logger,
4848
set,
4949
context: { memberId, adminUid },
50-
}) as ApproveProfileApiResponse;
50+
});
5151
}
5252
}

functions/src/admin-members-api/services/update-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,6 @@ function isFirestoreNotFoundError(error: unknown): boolean {
100100
typeof error === "object" &&
101101
error !== null &&
102102
"code" in error &&
103-
(error as { code: unknown }).code === NOT_FOUND_CODE
103+
error.code === NOT_FOUND_CODE
104104
);
105105
}

functions/src/admin-members-api/test-utils/create-admin-test-plugin.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { mock } from "bun:test";
22
import type { DecodedIdToken } from "firebase-admin/auth";
3-
import type { ProfileDocument } from "../../collections/index.js";
43
import type { AuthService } from "../../shared-api/services/auth/interface.js";
54
import type { EmailServiceInterface } from "../../shared-api/services/email/index.js";
65
import type { Logger } from "../../shared-api/types/logger.js";
@@ -95,7 +94,7 @@ export function createAdminTestPlugin(overrides?: {
9594
draft: false,
9695
createdAt: "2024-01-01T00:00:00.000Z",
9796
updatedAt: "2024-01-01T00:00:00.000Z",
98-
} as ProfileDocument,
97+
},
9998
}),
10099
),
101100
updateProfile: mock(() =>
@@ -107,7 +106,7 @@ export function createAdminTestPlugin(overrides?: {
107106
draft: false,
108107
createdAt: "2024-01-01T00:00:00.000Z",
109108
updatedAt: "2024-02-01T00:00:00.000Z",
110-
} as ProfileDocument,
109+
},
111110
}),
112111
),
113112
listUnlinkedProfiles: mock(() =>

functions/src/admin-messages-api/plugins/admin-messages-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function createAdminMessagesPlugin(services?: PartialServices) {
8181
logger,
8282
set,
8383
}) => {
84-
const typedBody = body as { sent: boolean };
84+
const typedBody = body;
8585
return updateMessageLogic({
8686
messageId: params.messageId,
8787
sent: typedBody.sent,

functions/src/profiles-api/routes/create-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ export async function createProfileLogic({
134134
set,
135135
context: { uid },
136136
});
137-
return errorResponse as CreateProfileResponse;
137+
return errorResponse;
138138
}
139139
}

functions/src/profiles-api/services/profile-store/create-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ function isFirestoreAlreadyExistsError(error: unknown): boolean {
8383
typeof error === "object" &&
8484
error !== null &&
8585
"code" in error &&
86-
(error as { code: unknown }).code === ALREADY_EXISTS_CODE
86+
error.code === ALREADY_EXISTS_CODE
8787
);
8888
}

functions/src/profiles-api/services/profile-store/write-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ function isFirestoreNotFoundError(error: unknown): boolean {
8989
typeof error === "object" &&
9090
error !== null &&
9191
"code" in error &&
92-
(error as { code: unknown }).code === NOT_FOUND_CODE
92+
error.code === NOT_FOUND_CODE
9393
);
9494
}

functions/src/test-utils/stripe-test-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function createMockCheckoutEvent(options: {
8787
idempotency_key: null,
8888
},
8989
type: "checkout.session.completed",
90-
} as Stripe.Event;
90+
};
9191
}
9292

9393
/**

0 commit comments

Comments
 (0)