[TS] Properly export unitary enums such that they're in *.d.mjs
authorMatt Corallo <git@bluematt.me>
Tue, 5 Jul 2022 18:18:54 +0000 (18:18 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 22 Jul 2022 21:51:54 +0000 (21:51 +0000)
Because the `ts/enums/*` files simply re-export from `bindings.mts`
rather than defining the enum from scratch, we have to include docs
and cannot use /* @internal */ on the `bindings.mts` unitary enums.

typescript_strings.py

index c8fcfc93c1a92f579483a43b4a8c987721b7d466..5ae728f9866a8871cf537c7792d9768262568645 100644 (file)
@@ -779,8 +779,12 @@ import * as bindings from '../bindings.mjs'
         out_c = out_c + "\t}\n"
         out_c = out_c + "}\n"
 
+        # Note that this is *not* marked /* @internal */ as we re-expose it directly in enums/
+        enum_comment_formatted = enum_doc_comment.replace("\n", "\n * ")
         out_typescript = f"""
-/* @internal */
+/**
+ * {enum_comment_formatted}
+ */
 export enum {struct_name} {{
        {out_typescript_enum_fields}
 }}