Fix all TypeScript errors: restore proper types and typed route casts
- Restore `as any` casts for Next.js typedRoutes on dynamic routes - Use proper types for PDF templates, invoice/expense data, DB schema - Fix PgColumn casts in sort helpers for expenses/invoices - Add null guards for optional port/client in record-export - Fix vitest config (remove invalid poolOptions) - Lint: 0 errors, TypeScript: 0 errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -99,7 +99,7 @@ export function buildBerthSpecInputs(
|
||||
: 'No maintenance records';
|
||||
|
||||
return {
|
||||
portName: port?.name ?? 'Port Nimara',
|
||||
portName: (port?.name as string) ?? 'Port Nimara',
|
||||
title: `Berth Specification — Mooring ${berth.mooringNumber}`,
|
||||
berthInfo,
|
||||
dimensions,
|
||||
|
||||
@@ -29,7 +29,7 @@ export function buildClientSummaryInputs(
|
||||
client.nationality ? `Nationality: ${client.nationality}` : null,
|
||||
client.source ? `Source: ${client.source}` : null,
|
||||
client.isProxy ? `Proxy: Yes${client.proxyType ? ` (${client.proxyType})` : ''}` : null,
|
||||
`Added: ${new Date(client.createdAt).toLocaleDateString('en-GB')}`,
|
||||
`Added: ${new Date(client.createdAt as string | Date).toLocaleDateString('en-GB')}`,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join('\n');
|
||||
@@ -38,7 +38,7 @@ export function buildClientSummaryInputs(
|
||||
? contacts
|
||||
.map(
|
||||
(c) =>
|
||||
`${c.channel.charAt(0).toUpperCase() + c.channel.slice(1)}${c.isPrimary ? ' (primary)' : ''}: ${c.value}${c.label ? ` [${c.label}]` : ''}`,
|
||||
`${(c.channel as string).charAt(0).toUpperCase() + (c.channel as string).slice(1)}${c.isPrimary ? ' (primary)' : ''}: ${c.value}${c.label ? ` [${c.label}]` : ''}`,
|
||||
)
|
||||
.join('\n')
|
||||
: 'No contacts on file';
|
||||
@@ -64,7 +64,7 @@ export function buildClientSummaryInputs(
|
||||
? interestList
|
||||
.map(
|
||||
(i) =>
|
||||
`• ${i.pipelineStage ?? 'open'}${i.berthMooringNumber ? ` — Berth ${i.berthMooringNumber}` : ''}${i.leadCategory ? ` [${i.leadCategory}]` : ''} (${new Date(i.createdAt).toLocaleDateString('en-GB')})`,
|
||||
`• ${i.pipelineStage ?? 'open'}${i.berthMooringNumber ? ` — Berth ${i.berthMooringNumber}` : ''}${i.leadCategory ? ` [${i.leadCategory}]` : ''} (${new Date(i.createdAt as string | Date).toLocaleDateString('en-GB')})`,
|
||||
)
|
||||
.join('\n')
|
||||
: 'No pipeline interests on file';
|
||||
@@ -74,13 +74,13 @@ export function buildClientSummaryInputs(
|
||||
? activity
|
||||
.map(
|
||||
(a) =>
|
||||
`${new Date(a.createdAt).toLocaleDateString('en-GB')} ${a.action} ${a.entityType}${a.fieldChanged ? ` (${a.fieldChanged})` : ''}`,
|
||||
`${new Date(a.createdAt as string | Date).toLocaleDateString('en-GB')} ${a.action} ${a.entityType}${a.fieldChanged ? ` (${a.fieldChanged})` : ''}`,
|
||||
)
|
||||
.join('\n')
|
||||
: 'No recent activity';
|
||||
|
||||
return {
|
||||
portName: port?.name ?? 'Port Nimara',
|
||||
portName: (port?.name as string) ?? 'Port Nimara',
|
||||
title: `Client Summary — ${client.fullName ?? ''}`,
|
||||
clientInfo,
|
||||
contacts: contactsText,
|
||||
|
||||
@@ -64,13 +64,13 @@ export function buildInterestSummaryInputs(
|
||||
.join(' | ');
|
||||
|
||||
const milestones = [
|
||||
`First contact: ${formatDate(interest.dateFirstContact)}`,
|
||||
`Last contact: ${formatDate(interest.dateLastContact)}`,
|
||||
`EOI sent: ${formatDate(interest.dateEoiSent)}`,
|
||||
`EOI signed: ${formatDate(interest.dateEoiSigned)}`,
|
||||
`Contract sent: ${formatDate(interest.dateContractSent)}`,
|
||||
`Contract signed: ${formatDate(interest.dateContractSigned)}`,
|
||||
`Deposit received: ${formatDate(interest.dateDepositReceived)}`,
|
||||
`First contact: ${formatDate(interest.dateFirstContact as Date | string | null | undefined)}`,
|
||||
`Last contact: ${formatDate(interest.dateLastContact as Date | string | null | undefined)}`,
|
||||
`EOI sent: ${formatDate(interest.dateEoiSent as Date | string | null | undefined)}`,
|
||||
`EOI signed: ${formatDate(interest.dateEoiSigned as Date | string | null | undefined)}`,
|
||||
`Contract sent: ${formatDate(interest.dateContractSent as Date | string | null | undefined)}`,
|
||||
`Contract signed: ${formatDate(interest.dateContractSigned as Date | string | null | undefined)}`,
|
||||
`Deposit received: ${formatDate(interest.dateDepositReceived as Date | string | null | undefined)}`,
|
||||
].join('\n');
|
||||
|
||||
const notesText = interest.notes
|
||||
@@ -82,13 +82,13 @@ export function buildInterestSummaryInputs(
|
||||
? timeline
|
||||
.map(
|
||||
(e) =>
|
||||
`${formatDate(e.createdAt)} ${e.action ?? e.eventType ?? 'event'} ${e.entityType ?? e.type ?? ''}${e.fieldChanged ? ` [${e.fieldChanged}]` : ''}`,
|
||||
`${formatDate(e.createdAt as Date | string | null | undefined)} ${e.action ?? e.eventType ?? 'event'} ${e.entityType ?? e.type ?? ''}${e.fieldChanged ? ` [${e.fieldChanged}]` : ''}`,
|
||||
)
|
||||
.join('\n')
|
||||
: 'No timeline events';
|
||||
|
||||
return {
|
||||
portName: port?.name ?? 'Port Nimara',
|
||||
portName: (port?.name as string) ?? 'Port Nimara',
|
||||
title: `Interest Summary — ${client?.fullName ?? 'Unknown Client'}`,
|
||||
clientInfo,
|
||||
berthInfo,
|
||||
|
||||
@@ -107,10 +107,10 @@ export function buildInvoiceInputs(
|
||||
totalsText += `\n─────────────\nTOTAL: ${invoice.currency} ${Number(invoice.total).toFixed(2)}`;
|
||||
|
||||
return {
|
||||
portName: port?.name ?? 'Port Nimara',
|
||||
portName: (port?.name as string) ?? 'Port Nimara',
|
||||
invoiceTitle: 'INVOICE',
|
||||
invoiceNumber: invoice.invoiceNumber,
|
||||
invoiceDate: `Date: ${new Date(invoice.createdAt).toLocaleDateString('en-GB')}`,
|
||||
invoiceNumber: invoice.invoiceNumber as string,
|
||||
invoiceDate: `Date: ${new Date(invoice.createdAt as string | Date).toLocaleDateString('en-GB')}`,
|
||||
dueDate: `Due: ${invoice.dueDate}`,
|
||||
clientInfo: `${invoice.clientName}\n${invoice.billingEmail ?? ''}\n${invoice.billingAddress ?? ''}`.trim(),
|
||||
lineItems: itemLines || 'No line items',
|
||||
|
||||
Reference in New Issue
Block a user