refactor(ts-migration): Phase 11 batch 10 — the authoring and settings pages

Nine admin pages: `AgentDetail`, both skill editors, the three Workspace
pages, `SkillDevelopment`, `Settings` and `Profile`. 9/9 byte-identical,
bundle hash unchanged.

Six errors, five of them the same shape this phase has met repeatedly:
`Object.values(skill.ui || {}).flatMap((page) => page.sections)` yields
`unknown` because inference into the union parameter of `values` does not
distribute. Three copies of that line across the two editors and
`WorkspaceSkills`, plus one `Object.entries` and one `new Set` whose
element type reached a React `key`, where `unknown` is not allowed.

The sixth is worth its own line. `WorkspaceSkills.toggleSkill` builds a
preferences patch as `{ disabledSkills }` and then adds `customSkills` to
it conditionally, several lines later, when re-enabling a skill flips an
inactive definition back to active. The literal's inferred type does not
carry a key assigned after the fact, so the later write looked wrong.
The annotation names both keys and marks the conditional one optional,
which is what the function does.

Measured against `b99dc7c`:

  typecheck   6 errors, unchanged; no new error anywhere
  lint        exit 0, 0 errors, 289 warnings
  npm test    1684/1691, the same 7 failures verbatim
  build       exit 0, identical bundle hash 74d17e2d…
  type erasure  113/113 byte-identical across Phase 11 so far

Nine files left in Phase 11, all data pages. No baseline artifact
touched — three of those nine are the pages the baselines cover, so the
recapture question arrives with the next batch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HBG1wnuRfJKCstGB8Fekr8
This commit is contained in:
2026-09-18 15:40:35 +05:30
parent b99dc7c576
commit a0f3f77900
9 changed files with 6 additions and 6 deletions

View File

@@ -289,7 +289,7 @@ export default function OwliverSkillEditor() {
/* The other half of the same definition, when it has one. Read-only: this
editor does not own it, but hiding it would misrepresent the skill. */
const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []);
const uiSections = Object.values<any>(preview?.ui || {}).flatMap((page) => page.sections || []);
return (
<AdminPage

View File

@@ -114,7 +114,7 @@ export default function SkillEditor() {
extended where it offers a slot, so this list is the surfaces' own — never
a fixed set of names typed here. */
const placements = useMemo(
() => [...new Set(selectedPages.flatMap((p) => surfaceFor(p)?.placements || []))],
() => [...new Set<any>(selectedPages.flatMap((p) => surfaceFor(p)?.placements || []))],
[selectedPages]
);
@@ -164,7 +164,7 @@ export default function SkillEditor() {
/* Every section this definition registers, flattened — the preview reads it
for both the type line and the configuration block. */
const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []);
const uiSections = Object.values<any>(preview?.ui || {}).flatMap((page) => page.sections || []);
/**
* A field edit, written into the definition.
@@ -657,7 +657,7 @@ export default function SkillEditor() {
UI configuration
</dt>
<dd className="mt-1 space-y-2">
{Object.entries(preview.ui).map(([page, config]) => (
{Object.entries<any>(preview.ui).map(([page, config]) => (
<div key={page} className="rounded-lg border border-border bg-surface-subtle p-2.5">
<p className="text-[10px] font-semibold uppercase tracking-wide text-krow-blue">
{surfaceFor(page)?.label || page}

View File

@@ -86,7 +86,7 @@ const surfaceLabels = (skill) =>
*/
function contribution(skill, facet) {
if (facet === 'ui') {
const sections = Object.values(skill.ui || {}).flatMap((page) => page.sections || []);
const sections = Object.values<any>(skill.ui || {}).flatMap((page) => page.sections || []);
return {
type: [...new Set(sections.map((s) => sectionTypeLabel(s.type)))].join(' · '),
detail: [...new Set(sections.map((s) => placementLabel(s.placement)))].join(', '),
@@ -297,7 +297,7 @@ export default function WorkspaceSkills() {
*/
const toggleSkill = (id, enabled) => {
const skill = skills.find((s) => s.id === id);
const patch = {
const patch: { disabledSkills: any; customSkills?: any } = {
disabledSkills: enabled
? disabledSkills.filter((s) => s !== id)
: [...new Set([...disabledSkills, id])],