chore: cleans up outstanding tsc lints

This commit is contained in:
Lewis Wynne 2026-04-07 18:22:21 +01:00
parent a2b904811a
commit 12cb8c387f
5 changed files with 9 additions and 3 deletions

View file

@ -83,6 +83,9 @@ export function formatFieldOutput(
const optLabels = vals.map((v) => field.options.find((o) => o.value === v)?.label ?? v); const optLabels = vals.map((v) => field.options.find((o) => o.value === v)?.label ?? v);
return `${label}: ${optLabels.join(', ')}`; return `${label}: ${optLabels.join(', ')}`;
} }
case 'separator':
return null;
} }
} }

View file

@ -24,6 +24,9 @@ function zodForField(field: FieldDef): z.ZodTypeAny {
case 'checkbox': case 'checkbox':
case 'languages': case 'languages':
return z.array(z.string()).optional(); return z.array(z.string()).optional();
case 'separator':
return z.never();
} }
} }

View file

@ -20,7 +20,7 @@ function allFields(template: Template) {
function migrateData(char: Character, preset: Template) { function migrateData(char: Character, preset: Template) {
for (const record of preset.records) { for (const record of preset.records) {
for (const field of record.fields) { for (const field of record.fields) {
if (!field.from) continue; if (field.type === 'separator' || !field.from) continue;
const newKey = slugify(field.label); const newKey = slugify(field.label);
if (char.data[newKey] !== undefined) continue; if (char.data[newKey] !== undefined) continue;
const oldNames = field.from.split(',').map((s) => s.trim()); const oldNames = field.from.split(',').map((s) => s.trim());

View file

@ -22,7 +22,7 @@ export function diffTemplates(old: Template, current: Template): TemplateDiff {
for (const record of current.records) { for (const record of current.records) {
for (const field of record.fields) { for (const field of record.fields) {
if (!field.from) continue; if (field.type === 'separator' || !field.from) continue;
const fromNames = field.from.split(',').map((s) => s.trim()); const fromNames = field.from.split(',').map((s) => s.trim());
const match = fromNames.find((f) => oldFields.has(f)); const match = fromNames.find((f) => oldFields.has(f));
if (match && !newFields.has(match)) { if (match && !newFields.has(match)) {

View file

@ -145,7 +145,7 @@
New Character New Character
</button> </button>
<button <button
onclick={() => emptyFileInput.click()} onclick={() => emptyFileInput!.click()}
class="px-4 py-2 rounded text-sm border hover:opacity-80" class="px-4 py-2 rounded text-sm border hover:opacity-80"
style="border-color: var(--border); color: var(--text-muted);" style="border-color: var(--border); color: var(--text-muted);"
> >