From c088e5a5acf0bcf956900b723c7c436d7dcf39f0 Mon Sep 17 00:00:00 2001 From: Virgil Date: Tue, 31 Mar 2026 20:54:40 +0000 Subject: [PATCH] feat(codegen): emit module boundary in TypeScript definitions Co-Authored-By: Virgil --- codegen/codegen_test.go | 1 + codegen/typescript.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/codegen/codegen_test.go b/codegen/codegen_test.go index f1bb520..39a1bcd 100644 --- a/codegen/codegen_test.go +++ b/codegen/codegen_test.go @@ -95,6 +95,7 @@ func TestGenerateTypeScriptDefinitions_DeduplicatesAndOrders_Good(t *testing.T) assert.Equal(t, 1, countSubstr(dts, `"alpha-panel": AlphaPanel;`)) assert.Equal(t, 1, countSubstr(dts, `export declare class AlphaPanel extends HTMLElement`)) assert.Equal(t, 1, countSubstr(dts, `export declare class ZedPanel extends HTMLElement`)) + assert.Contains(t, dts, "export {};") assert.Less(t, strings.Index(dts, `"alpha-panel": AlphaPanel;`), strings.Index(dts, `"zed-panel": ZedPanel;`)) } diff --git a/codegen/typescript.go b/codegen/typescript.go index ce02e85..a71199b 100644 --- a/codegen/typescript.go +++ b/codegen/typescript.go @@ -55,5 +55,7 @@ func GenerateTypeScriptDefinitions(slots map[string]string) string { b.WriteString("}\n\n") } + b.WriteString("export {};\n") + return b.String() }