Skip to content

Commit da995eb

Browse files
GearsDatapackslpil
authored andcommitted
Fix export generation
1 parent 5968ab3 commit da995eb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

compiler-core/src/javascript/import.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,15 @@ impl<'a> Imports<'a> {
6464
break_(",", " ")
6565
]
6666
.group();
67+
68+
let export_keyword = match codegen_target {
69+
JavaScriptCodegenTarget::JavaScript => "export {",
70+
JavaScriptCodegenTarget::TypeScriptDeclarations => "export type {",
71+
};
72+
6773
imports
6874
.append(line())
69-
.append("export type {")
75+
.append(export_keyword)
7076
.append(names)
7177
.append("};")
7278
.append(line())

compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__type_alias__private_type_in_opaque_type.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
source: compiler-core/src/javascript/tests/type_alias.rs
3-
assertion_line: 14
43
expression: "\ntype PrivateType {\n PrivateType\n}\n\npub opaque type OpaqueType {\n OpaqueType(PrivateType)\n}\n"
5-
snapshot_kind: text
64
---
75
----- SOURCE CODE
86

@@ -18,10 +16,6 @@ pub opaque type OpaqueType {
1816
----- TYPESCRIPT DEFINITIONS
1917
import type * as _ from "../gleam.d.mts";
2018

21-
declare class PrivateType extends _.CustomType {}
22-
23-
declare type PrivateType$ = PrivateType;
24-
2519
declare class OpaqueType extends _.CustomType {
2620
/** @deprecated */
2721
constructor(argument$0: PrivateType$);

0 commit comments

Comments
 (0)