| 80 | function sentences(): { name: string; text: string }[] { |
| 81 | const out: { name: string; text: string }[] = []; |
| 82 | const walk = (name: string, value: unknown): void => { |
| 83 | if (typeof value === 'string') { |
| 84 | out.push({ name, text: value }); |
| 85 | return; |
| 86 | } |
| 87 | if (Array.isArray(value)) { |
| 88 | value.forEach((entry) => walk(name, entry)); |
| 89 | return; |
| 90 | } |
| 91 | if (typeof value === 'function') { |
| 92 | // Eine Funktion, die mit Beispielwerten nicht laeuft, wird nicht |
| 93 | // erraten: sie steht dann nicht in der Pruefung, und das steht im |
| 94 | // Ergebnis unten als Zahl. |
| 95 | for (const first of ['notIndexed', 'unknown', 'unsupported', 'inferred', 'sample']) { |
| 96 | try { |
| 97 | walk(name, (value as (...args: unknown[]) => unknown)(first, ...SAMPLES.slice(1))); |
| 98 | } catch { |
| 99 | // naechster Beispielwert |
| 100 | } |
| 101 | } |
| 102 | return; |
| 103 | } |
| 104 | if (value !== null && typeof value === 'object') { |
| 105 | for (const entry of Object.values(value as Record<string, unknown>)) { |
| 106 | walk(name, entry); |
| 107 | } |
| 108 | } |
| 109 | }; |
| 110 | for (const [name, value] of Object.entries(strings)) { |
| 111 | walk(name, value); |
| 112 | } |