diff --git a/go-runtime/compile/build.go b/go-runtime/compile/build.go index 2733c74be0..17b5c86168 100644 --- a/go-runtime/compile/build.go +++ b/go-runtime/compile/build.go @@ -1029,10 +1029,11 @@ func imports(m *schema.Module, aliasesMustBeExported bool) map[string]string { } case *schema.TypeAlias: - if !aliasesMustBeExported || n.IsExported() { - if importPath, dirName, ok := goImportForWidenedType(n); ok && extraImports[importPath] == optional.None[string]() { - extraImports[importPath] = dirName - } + if aliasesMustBeExported && !n.IsExported() { + return next() + } + if importPath, dirName, ok := goImportForWidenedType(n); ok && extraImports[importPath] == optional.None[string]() { + extraImports[importPath] = dirName } default: }