feat(csv-loader): expand custom type references in schemas

Allow custom type names to be expanded before parsing the schema
string. This enables using declared types within complex structures
like tuples or arrays. The original schema string is preserved for
type generation to ensure the output uses the named type rather than
the expanded inline definition.
This commit is contained in:
2026-04-22 17:58:36 +08:00
parent 46504a53dd
commit e0317946d5
4 changed files with 48 additions and 2 deletions
+2 -1
View File
@@ -60,7 +60,8 @@ export function generateTypeDefinition(
.map((config) => {
const typeStr = config.declaredTypeName
? config.declaredTypeName
: schemaToTypeString(config.schema, resourceNames);
: (config.schemaString ??
schemaToTypeString(config.schema, resourceNames));
return ` readonly ${config.name}: ${typeStr};`;
})
.join("\n");