diff --git a/packages/compiler/src/babel-types/generator/patch.js b/packages/compiler/src/babel-types/generator/patch.js
index 360119a4f3..b291fb6924 100644
--- a/packages/compiler/src/babel-types/generator/patch.js
+++ b/packages/compiler/src/babel-types/generator/patch.js
@@ -171,6 +171,12 @@ Object.assign(Printer.prototype, {
this.token(tagName);
}
+ if (node.typeArguments) {
+ this.token("<");
+ this.printList(node.typeArguments.params, node);
+ this.token(">");
+ }
+
if (node.var) {
this.token("/");
this.print(node.var, node);
@@ -187,6 +193,14 @@ Object.assign(Printer.prototype, {
}
if (node.body.params.length) {
+ if (node.typeParameters) {
+ if (!node.typeArguments) {
+ this.token(" ");
+ }
+ this.token("<");
+ this.printList(node.typeParameters.params, node);
+ this.token(">");
+ }
this.token("|");
this.printList(node.body.params, node);
this.token("|");
diff --git a/packages/compiler/src/babel-types/types/definitions.js b/packages/compiler/src/babel-types/types/definitions.js
index b1debfd5b5..21e11c4f32 100644
--- a/packages/compiler/src/babel-types/types/definitions.js
+++ b/packages/compiler/src/babel-types/types/definitions.js
@@ -192,6 +192,20 @@ const MarkoDefinitions = {
),
optional: true,
},
+ typeArguments: {
+ validate: chain(
+ assertValueType("array"),
+ assertEach(assertNodeType("TypeAnnotation"))
+ ),
+ optional: true,
+ },
+ typeParameters: {
+ validate: chain(
+ assertValueType("array"),
+ assertEach(assertNodeType("TypeAnnotation"))
+ ),
+ optional: true,
+ },
rawValue: {
validate: assertValueType("string"),
optional: true,
diff --git a/packages/translator-default/test/fixtures/typescript-generic-tag/snapshots/generated-expected.marko b/packages/translator-default/test/fixtures/typescript-generic-tag/snapshots/generated-expected.marko
index 2cfd56ff9d..e3dd7b94d5 100644
--- a/packages/translator-default/test/fixtures/typescript-generic-tag/snapshots/generated-expected.marko
+++ b/packages/translator-default/test/fixtures/typescript-generic-tag/snapshots/generated-expected.marko
@@ -1,7 +1,7 @@
-
-
+/>
+|x|>
${x}
-
+|x| arg="hello">
${x}
\ No newline at end of file