mirror of
https://github.com/marko-js/marko.git
synced 2026-02-01 16:07:13 +00:00
fix(babel): use correct types for params and args
This commit is contained in:
parent
648a94928f
commit
ad176646e1
@ -208,7 +208,7 @@ export function parseMarko(file) {
|
||||
);
|
||||
},
|
||||
onTagTypeParams(part) {
|
||||
currentTag.node.typeParameters = parseTypeParams(
|
||||
currentBody.node.typeParameters = parseTypeParams(
|
||||
file,
|
||||
parser.read(part.value),
|
||||
part.start,
|
||||
|
||||
@ -193,12 +193,12 @@ Object.assign(Printer.prototype, {
|
||||
}
|
||||
|
||||
if (node.body.params.length) {
|
||||
if (node.typeParameters) {
|
||||
if (node.body.typeParameters) {
|
||||
if (!node.typeArguments) {
|
||||
this.token(" ");
|
||||
}
|
||||
this.token("<");
|
||||
this.printList(node.typeParameters.params, node);
|
||||
this.printList(node.body.typeParameters.params, node);
|
||||
this.token(">");
|
||||
}
|
||||
this.token("|");
|
||||
|
||||
@ -147,7 +147,7 @@ const MarkoDefinitions = {
|
||||
MarkoTagBody: {
|
||||
aliases: ["Marko", "BlockParent", "Scope"],
|
||||
builder: ["body", "params"],
|
||||
visitor: ["params", "body"],
|
||||
visitor: ["typeParameters", "params", "body"],
|
||||
fields: {
|
||||
params: {
|
||||
validate: chain(
|
||||
@ -156,6 +156,10 @@ const MarkoDefinitions = {
|
||||
),
|
||||
default: [],
|
||||
},
|
||||
typeParameters: {
|
||||
validate: assertNodeType("TSTypeParameterDeclaration"),
|
||||
optional: true,
|
||||
},
|
||||
body: {
|
||||
validate: arrayOfType([
|
||||
"MarkoTag",
|
||||
@ -173,7 +177,14 @@ const MarkoDefinitions = {
|
||||
MarkoTag: {
|
||||
aliases: ["Marko", "Statement"],
|
||||
builder: ["name", "attributes", "body", "arguments", "var"],
|
||||
visitor: ["name", "attributes", "body", "arguments", "var"],
|
||||
visitor: [
|
||||
"name",
|
||||
"typeArguments",
|
||||
"attributes",
|
||||
"body",
|
||||
"arguments",
|
||||
"var",
|
||||
],
|
||||
fields: {
|
||||
name: {
|
||||
validate: assertNodeType("Expression"),
|
||||
@ -193,17 +204,7 @@ const MarkoDefinitions = {
|
||||
optional: true,
|
||||
},
|
||||
typeArguments: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
assertEach(assertNodeType("TypeAnnotation"))
|
||||
),
|
||||
optional: true,
|
||||
},
|
||||
typeParameters: {
|
||||
validate: chain(
|
||||
assertValueType("array"),
|
||||
assertEach(assertNodeType("TypeAnnotation"))
|
||||
),
|
||||
validate: assertNodeType("TSTypeParameterInstantiation"),
|
||||
optional: true,
|
||||
},
|
||||
rawValue: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user