[ts] Default typeAnnotation of TSTypePredicate to null (#13354)
This commit is contained in:
parent
533e63af52
commit
d6a5f6190d
@ -1242,6 +1242,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
if (thisTypePredicate.type === "TSThisType") {
|
if (thisTypePredicate.type === "TSThisType") {
|
||||||
node.parameterName = (thisTypePredicate: N.TsThisType);
|
node.parameterName = (thisTypePredicate: N.TsThisType);
|
||||||
node.asserts = true;
|
node.asserts = true;
|
||||||
|
(node: N.TsTypePredicate).typeAnnotation = null;
|
||||||
thisTypePredicate = this.finishNode(node, "TSTypePredicate");
|
thisTypePredicate = this.finishNode(node, "TSTypePredicate");
|
||||||
} else {
|
} else {
|
||||||
this.resetStartLocationFromNode(thisTypePredicate, node);
|
this.resetStartLocationFromNode(thisTypePredicate, node);
|
||||||
@ -1264,6 +1265,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
|||||||
// : asserts foo
|
// : asserts foo
|
||||||
node.parameterName = this.parseIdentifier();
|
node.parameterName = this.parseIdentifier();
|
||||||
node.asserts = asserts;
|
node.asserts = asserts;
|
||||||
|
(node: N.TsTypePredicate).typeAnnotation = null;
|
||||||
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
|
||||||
return this.finishNode(t, "TSTypeAnnotation");
|
return this.finishNode(t, "TSTypeAnnotation");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1347,7 +1347,7 @@ export type TsTypeReference = TsTypeBase & {
|
|||||||
export type TsTypePredicate = TsTypeBase & {
|
export type TsTypePredicate = TsTypeBase & {
|
||||||
type: "TSTypePredicate",
|
type: "TSTypePredicate",
|
||||||
parameterName: Identifier | TsThisType,
|
parameterName: Identifier | TsThisType,
|
||||||
typeAnnotation: TsTypeAnnotation,
|
typeAnnotation: TsTypeAnnotation | null,
|
||||||
asserts: boolean,
|
asserts: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,8 @@
|
|||||||
"start":106,"end":111,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":47},"identifierName":"value"},
|
"start":106,"end":111,"loc":{"start":{"line":2,"column":42},"end":{"line":2,"column":47},"identifierName":"value"},
|
||||||
"name": "value"
|
"name": "value"
|
||||||
},
|
},
|
||||||
"asserts": true
|
"asserts": true,
|
||||||
|
"typeAnnotation": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"id": null,
|
"id": null,
|
||||||
|
|||||||
@ -45,7 +45,8 @@
|
|||||||
"type": "TSThisType",
|
"type": "TSThisType",
|
||||||
"start":25,"end":29,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}}
|
"start":25,"end":29,"loc":{"start":{"line":2,"column":15},"end":{"line":2,"column":19}}
|
||||||
},
|
},
|
||||||
"asserts": true
|
"asserts": true,
|
||||||
|
"typeAnnotation": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
|
|||||||
@ -44,7 +44,8 @@
|
|||||||
"start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"value"},
|
"start":57,"end":62,"loc":{"start":{"line":1,"column":57},"end":{"line":1,"column":62},"identifierName":"value"},
|
||||||
"name": "value"
|
"name": "value"
|
||||||
},
|
},
|
||||||
"asserts": true
|
"asserts": true,
|
||||||
|
"typeAnnotation": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,8 @@
|
|||||||
"start":108,"end":113,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":49},"identifierName":"value"},
|
"start":108,"end":113,"loc":{"start":{"line":2,"column":44},"end":{"line":2,"column":49},"identifierName":"value"},
|
||||||
"name": "value"
|
"name": "value"
|
||||||
},
|
},
|
||||||
"asserts": true
|
"asserts": true,
|
||||||
|
"typeAnnotation": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
|
|||||||
@ -47,7 +47,8 @@
|
|||||||
"start":62,"end":67,"loc":{"start":{"line":1,"column":62},"end":{"line":1,"column":67},"identifierName":"value"},
|
"start":62,"end":67,"loc":{"start":{"line":1,"column":62},"end":{"line":1,"column":67},"identifierName":"value"},
|
||||||
"name": "value"
|
"name": "value"
|
||||||
},
|
},
|
||||||
"asserts": true
|
"asserts": true,
|
||||||
|
"typeAnnotation": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user