(
subBlock: SubBlockConfig | undefined,
rawValue: unknown,
skills: Array<{ id: string; name: string }>
)
| 483 | * reference. Unresolvable entries are skipped rather than shown as raw ids. |
| 484 | */ |
| 485 | export function resolveSkillsLabel( |
| 486 | subBlock: SubBlockConfig | undefined, |
| 487 | rawValue: unknown, |
| 488 | skills: Array<{ id: string; name: string }> |
| 489 | ): string | null { |
| 490 | if (subBlock?.type !== 'skill-input') return null |
| 491 | if (!Array.isArray(rawValue) || rawValue.length === 0) return null |
| 492 | |
| 493 | const names = rawValue |
| 494 | .map((skill: unknown) => { |
| 495 | if (!skill || typeof skill !== 'object') return null |
| 496 | const s = skill as { skillId?: string; name?: string } |
| 497 | |
| 498 | if (s.skillId) { |
| 499 | const found = skills.find((candidate) => candidate.id === s.skillId) |
| 500 | if (found?.name) return found.name |
| 501 | } |
| 502 | if (typeof s.name === 'string' && s.name) return s.name |
| 503 | |
| 504 | return null |
| 505 | }) |
| 506 | .filter((name): name is string => !!name) |
| 507 | |
| 508 | return summarizeNames(names) |
| 509 | } |
no test coverage detected