diff --git a/src/lib/skills/conversationFlow.js b/src/lib/skills/conversationFlow.ts similarity index 100% rename from src/lib/skills/conversationFlow.js rename to src/lib/skills/conversationFlow.ts diff --git a/src/lib/skills/draftFlow.js b/src/lib/skills/draftFlow.ts similarity index 98% rename from src/lib/skills/draftFlow.js rename to src/lib/skills/draftFlow.ts index 566ae74..d9f3462 100644 --- a/src/lib/skills/draftFlow.js +++ b/src/lib/skills/draftFlow.ts @@ -228,7 +228,7 @@ export const noDraftReply = () => doc( /** The weights this position actually carries, never a default dressed as one. */ export function weightsOf(position) { const criteria = position?.vetting_criteria || {}; - const entries = Object.entries(criteria).filter(([, value]) => Number.isFinite(Number(value))); + const entries = Object.entries(criteria).filter(([, value]) => Number.isFinite(Number(value))); return { entries, total: entries.reduce((sum, [, value]) => sum + Number(value), 0), @@ -298,7 +298,7 @@ export function weightsFromQuestion(question, position) { } export const weightsSetReply = (position, next) => { - const total = Object.values(next).reduce((sum, value) => sum + Number(value), 0); + const total = Object.values(next).reduce((sum, value) => sum + Number(value), 0); return doc( heading('Vetting weights updated', position.title), diff --git a/src/lib/skills/saveFeedback.js b/src/lib/skills/saveFeedback.ts similarity index 95% rename from src/lib/skills/saveFeedback.js rename to src/lib/skills/saveFeedback.ts index 7aab46e..389a200 100644 --- a/src/lib/skills/saveFeedback.js +++ b/src/lib/skills/saveFeedback.ts @@ -16,8 +16,7 @@ import { toast } from '@/components/ds'; */ export function reportSave(message) { return { - /** @param {any} result */ - onSuccess: (result) => { + onSuccess: (result: any) => { if (result?.persisted === false) { toast.error( `${message} — but this browser would not store it, so it will be gone on reload. ` diff --git a/src/lib/skills/serverSuggestions.js b/src/lib/skills/serverSuggestions.ts similarity index 100% rename from src/lib/skills/serverSuggestions.js rename to src/lib/skills/serverSuggestions.ts diff --git a/src/lib/skills/surfaces.js b/src/lib/skills/surfaces.ts similarity index 100% rename from src/lib/skills/surfaces.js rename to src/lib/skills/surfaces.ts diff --git a/src/lib/skills/uiConfig.js b/src/lib/skills/uiConfig.ts similarity index 99% rename from src/lib/skills/uiConfig.js rename to src/lib/skills/uiConfig.ts index 330d7a3..bfca3d8 100644 --- a/src/lib/skills/uiConfig.js +++ b/src/lib/skills/uiConfig.ts @@ -394,4 +394,4 @@ export const sectionsForPage = (skill, page) => { /** How many UI sections a definition registers, across every page. */ export const countSections = (skill) => - Object.values(skill?.ui || {}).reduce((n, page) => n + (page.sections?.length || 0), 0); + Object.values(skill?.ui || {}).reduce((n, page) => n + (page.sections?.length || 0), 0); diff --git a/src/lib/skills/workforceFlow.js b/src/lib/skills/workforceFlow.ts similarity index 98% rename from src/lib/skills/workforceFlow.js rename to src/lib/skills/workforceFlow.ts index 6c2bc8f..9339210 100644 --- a/src/lib/skills/workforceFlow.js +++ b/src/lib/skills/workforceFlow.ts @@ -580,7 +580,24 @@ export function headcountFailed(position) { * position title, so accepting it goes back through the same resolution path a * typed sentence would — and re-checks the data before writing. */ -export function assignmentPreview(position, context) { +/** + * A reply from this module: a document, and sometimes chips to offer next. + * + * `followUp` is optional because two of the five branches genuinely omit it — + * "already fully staffed" and "nobody is both qualified and free" are answers + * with nothing to offer after them. Callers that spread it on, like + * `headcountSet`, therefore pass `undefined` through in those cases, which is + * what this has always done at run time. + * + * Both fields are `any`: the blocks are the document format's own structures + * and describing them belongs to that format, not here. + */ +export interface FlowReply { + doc: any; + followUp?: any; +} + +export function assignmentPreview(position, context): FlowReply { const plan = prepareAssignment(position, context); const demand = demandFor(position, context); diff --git a/src/lib/skills/yaml.js b/src/lib/skills/yaml.ts similarity index 100% rename from src/lib/skills/yaml.js rename to src/lib/skills/yaml.ts