style(tsconvert): enforce two-space indentation for TypeScript interfaces

- Add two spaces before each field in generated interfaces
- Use newlines between fields and closing brace for proper formatting
- Update test to validate proper indentation
- Document test requirements in AGENTS.md
This commit is contained in:
2026-01-29 20:34:28 -05:00
parent f308970531
commit 64b513e3de
3 changed files with 11 additions and 3 deletions

View File

@@ -133,7 +133,7 @@ func TestResultStruct(t *testing.T) {
// Verify Declarations
defs := GetFunctionDeclarations()
assert.Contains(t, defs, "declare function result(input: string): TestResult;")
assert.Contains(t, defs, "interface TestResult {id: number; data: number[]}")
assert.Contains(t, defs, "interface TestResult {\n id: number\n data: number[]\n}")
}
type TestAsyncArgs struct {

View File

@@ -155,14 +155,14 @@ func collectStructTypes(t reflect.Type, ts *TypeSet) {
fieldName += "?"
}
fields = append(fields, fmt.Sprintf("%s: %s", fieldName, tsType))
fields = append(fields, fmt.Sprintf(" %s: %s", fieldName, tsType))
// Recursively Collect Nested Types
collectType(field.Type, ts)
}
// Add Type Definition
definition := fmt.Sprintf("interface %s {%s}", name, strings.Join(fields, "; "))
definition := fmt.Sprintf("interface %s {\n%s\n}", name, strings.Join(fields, "\n"))
_ = ts.Add(name, definition)
}