Fix TypeScript types on Directors Forecast API functions
Add explicit generic return types to dfGetWorksheet/dfSaveWorksheet/ dfGetReport so TypeScript can infer the response shape in the component. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bd9ddbeda9
commit
fc903564fb
1 changed files with 7 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ReportMeta, ReportResult } from './types'
|
import type { ReportMeta, ReportResult, WorksheetData, ForecastReportData } from './types'
|
||||||
|
|
||||||
const BASE = '/reports/api'
|
const BASE = '/reports/api'
|
||||||
|
|
||||||
|
|
@ -32,18 +32,18 @@ export function runReport(id: string, dateFrom: string, dateTo: string): Promise
|
||||||
|
|
||||||
// ── Directors Forecast API ──────────────────────────────────────────────────
|
// ── Directors Forecast API ──────────────────────────────────────────────────
|
||||||
|
|
||||||
export function dfGetWorksheet(year: number, month: number) {
|
export function dfGetWorksheet(year: number, month: number): Promise<WorksheetData> {
|
||||||
return request(`/directors-forecast/worksheet/${year}/${month}`)
|
return request<WorksheetData>(`/directors-forecast/worksheet/${year}/${month}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dfSaveWorksheet(year: number, month: number, data: { pickup_avg_rate: number; overrides: object[] }) {
|
export function dfSaveWorksheet(year: number, month: number, data: { pickup_avg_rate: number; overrides: object[] }): Promise<{ ok: boolean }> {
|
||||||
return request(`/directors-forecast/worksheet/${year}/${month}`, {
|
return request<{ ok: boolean }>(`/directors-forecast/worksheet/${year}/${month}`, {
|
||||||
method: 'PUT', body: JSON.stringify(data),
|
method: 'PUT', body: JSON.stringify(data),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dfGetReport(year: number, month: number) {
|
export function dfGetReport(year: number, month: number): Promise<ForecastReportData> {
|
||||||
return request(`/directors-forecast/report/${year}/${month}`)
|
return request<ForecastReportData>(`/directors-forecast/report/${year}/${month}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function dfSaveSnapshot(year: number, month: number, data: object) {
|
export function dfSaveSnapshot(year: number, month: number, data: object) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue