summaryrefslogtreecommitdiff
path: root/tools/ts_library_builder/ast_util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ts_library_builder/ast_util.ts')
-rw-r--r--tools/ts_library_builder/ast_util.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/ts_library_builder/ast_util.ts b/tools/ts_library_builder/ast_util.ts
index 528036b99..85d0a3480 100644
--- a/tools/ts_library_builder/ast_util.ts
+++ b/tools/ts_library_builder/ast_util.ts
@@ -42,6 +42,22 @@ export function addSourceComment(
);
}
+/** Add a declaration of a type alias to a node */
+export function addTypeAlias(
+ node: StatementedNode,
+ name: string,
+ type: string,
+ hasDeclareKeyword = false,
+ jsdocs?: JSDoc[]
+) {
+ return node.addTypeAlias({
+ name,
+ type,
+ docs: jsdocs && jsdocs.map(jsdoc => jsdoc.getText()),
+ hasDeclareKeyword
+ });
+}
+
/** Add a declaration of a variable to a node */
export function addVariableDeclaration(
node: StatementedNode,