fix(server): resolve all TypeScript errors without unsafe type casts

Fix 20+ pre-existing TypeScript errors in the server package using
proper type-safe solutions — no `as any`, `as unknown`, or `any` types.

Key changes:
- Replace R.curry with regular curried arrow functions for proper inference
- Add return types to abstract methods (DynamicFilterRoleAbstractor)
- Add field declarations to empty models (ItemWarehouseQuantity)
- Add index signature to IMetadata for dynamic extra columns
- Use explicit field construction instead of pick()+cast patterns
- Convert moment format strings to Date objects where Date type expected
- Make interface properties optional where payloads don't include them
- Use native Array.reduce with proper typing instead of lodash chain

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ahmed Bouhuolia
2026-05-29 17:52:46 +02:00
parent 52c97f1401
commit edf12fb87a
26 changed files with 89 additions and 67 deletions

View File

@@ -32,14 +32,14 @@ export class InvoicePaymentIntegrationSubscriber {
paymentMethods.map(
async (paymentMethod: TransactionPaymentServiceEntry) => {
const payload = {
const payload: PaymentIntegrationTransactionLinkEventPayload = {
...omit(paymentMethod, ['id']),
saleInvoiceId: saleInvoice.id,
trx,
};
await this.eventPublisher.emitAsync(
events.paymentIntegrationLink.onPaymentIntegrationLink,
payload as PaymentIntegrationTransactionLinkEventPayload,
payload,
);
},
);
@@ -59,11 +59,11 @@ export class InvoicePaymentIntegrationSubscriber {
paymentMethods.map(
async (paymentMethod: TransactionPaymentServiceEntry) => {
const payload = {
const payload: PaymentIntegrationTransactionLinkDeleteEventPayload = {
...omit(paymentMethod, ['id']),
oldSaleInvoiceId: oldSaleInvoice.id,
trx,
} as PaymentIntegrationTransactionLinkDeleteEventPayload;
};
// Triggers `onPaymentIntegrationDeleteLink` event.
await this.eventPublisher.emitAsync(