From e6d91235a70c1b41095f6b037f7775967afc8947 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Tue, 21 Jun 2022 21:55:37 -0400 Subject: [PATCH] codegen: Correctly gen TS without defaults (#51155) --- pkg/codegen/coremodel.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/codegen/coremodel.go b/pkg/codegen/coremodel.go index 205777ca8ca..16a48c14c12 100644 --- a/pkg/codegen/coremodel.go +++ b/pkg/codegen/coremodel.go @@ -227,8 +227,10 @@ func (ls *ExtractedLineage) GenerateTypescriptCoremodel(path string) (WriteDiffe } // TODO until cuetsy can toposort its outputs, put the top/parent type at the bottom of the file. - parts.Nodes = append(parts.Nodes, top.T, top.D) - // parts.Nodes = append([]ts.Decl{top.T, top.D}, parts.Nodes...) + parts.Nodes = append(parts.Nodes, top.T) + if top.D != nil { + parts.Nodes = append(parts.Nodes, top.D) + } var strb strings.Builder var str string