mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-15 22:15:18 -05:00
Rename typeExpression to type (for some jsdoc)
(maybe I'll rename more later)
This commit is contained in:
@@ -5357,9 +5357,8 @@ namespace ts {
|
||||
|
||||
const declaration = <JSDocTypedefTag | JSDocCallbackTag | TypeAliasDeclaration>find(symbol.declarations, d =>
|
||||
isJSDocTypeAlias(d) || d.kind === SyntaxKind.TypeAliasDeclaration);
|
||||
const typeNode = isJSDocTypedefTag(declaration) ? declaration.typeExpression : isJSDocCallbackTag(declaration) ? declaration.signature : declaration.type;
|
||||
// If typeNode is missing, we will error in checkJSDocTypedefTag.
|
||||
let type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType;
|
||||
let type = declaration.type ? getTypeFromTypeNode(declaration.type) : unknownType;
|
||||
|
||||
if (popTypeResolution()) {
|
||||
const typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
|
||||
@@ -22147,7 +22146,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkJSDocTypedefTag(node: JSDocTypedefTag) {
|
||||
if (!node.typeExpression) {
|
||||
if (!node.type) {
|
||||
// If the node had `@property` tags, `typeExpression` would have been set to the first property tag.
|
||||
error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
|
||||
}
|
||||
@@ -22155,7 +22154,7 @@ namespace ts {
|
||||
if (node.name) {
|
||||
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
|
||||
}
|
||||
checkSourceElement(node.typeExpression);
|
||||
checkSourceElement(node.type);
|
||||
}
|
||||
|
||||
function checkJSDocParameterTag(node: JSDocParameterTag) {
|
||||
|
||||
@@ -480,18 +480,18 @@ namespace ts {
|
||||
case SyntaxKind.JSDocTemplateTag:
|
||||
return visitNodes(cbNode, cbNodes, (<JSDocTemplateTag>node).typeParameters);
|
||||
case SyntaxKind.JSDocTypedefTag:
|
||||
if ((node as JSDocTypedefTag).typeExpression &&
|
||||
(node as JSDocTypedefTag).typeExpression.kind === SyntaxKind.JSDocTypeExpression) {
|
||||
return visitNode(cbNode, (<JSDocTypedefTag>node).typeExpression) ||
|
||||
if ((node as JSDocTypedefTag).type &&
|
||||
(node as JSDocTypedefTag).type.kind === SyntaxKind.JSDocTypeExpression) {
|
||||
return visitNode(cbNode, (<JSDocTypedefTag>node).type) ||
|
||||
visitNode(cbNode, (<JSDocTypedefTag>node).fullName);
|
||||
}
|
||||
else {
|
||||
return visitNode(cbNode, (<JSDocTypedefTag>node).fullName) ||
|
||||
visitNode(cbNode, (<JSDocTypedefTag>node).typeExpression);
|
||||
visitNode(cbNode, (<JSDocTypedefTag>node).type);
|
||||
}
|
||||
case SyntaxKind.JSDocCallbackTag:
|
||||
return visitNode(cbNode, (node as JSDocCallbackTag).fullName) ||
|
||||
visitNode(cbNode, (node as JSDocCallbackTag).signature);
|
||||
visitNode(cbNode, (node as JSDocCallbackTag).type);
|
||||
case SyntaxKind.JSDocSignature:
|
||||
return visitNodes(cbNode, cbNodes, node.decorators) ||
|
||||
visitNodes(cbNode, cbNodes, node.modifiers) ||
|
||||
@@ -6737,7 +6737,7 @@ namespace ts {
|
||||
// Debug.assert(child.kind !== SyntaxKind.JSDocTypeTag);
|
||||
jsdocSignature.parameters = append(jsdocSignature.parameters as MutableNodeArray<JSDocParameterTag>, child);
|
||||
}
|
||||
callbackTag.signature = finishNode(jsdocSignature);
|
||||
callbackTag.type = finishNode(jsdocSignature);
|
||||
return finishNode(callbackTag);
|
||||
}
|
||||
|
||||
@@ -6764,7 +6764,7 @@ namespace ts {
|
||||
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
|
||||
skipWhitespace();
|
||||
|
||||
typedefTag.typeExpression = typeExpression;
|
||||
typedefTag.type = typeExpression;
|
||||
if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) {
|
||||
let child: JSDocTypeTag | JSDocPropertyTag | false;
|
||||
let jsdocTypeLiteral: JSDocTypeLiteral;
|
||||
@@ -6790,7 +6790,7 @@ namespace ts {
|
||||
if (typeExpression && typeExpression.type.kind === SyntaxKind.ArrayType) {
|
||||
jsdocTypeLiteral.isArrayType = true;
|
||||
}
|
||||
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
|
||||
typedefTag.type = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
|
||||
childTypeTag.typeExpression :
|
||||
finishNode(jsdocTypeLiteral);
|
||||
}
|
||||
|
||||
@@ -2384,7 +2384,7 @@ namespace ts {
|
||||
kind: SyntaxKind.JSDocTypedefTag;
|
||||
fullName?: JSDocNamespaceDeclaration | Identifier;
|
||||
name?: Identifier;
|
||||
typeExpression?: JSDocTypeExpression | JSDocTypeLiteral;
|
||||
type?: JSDocTypeExpression | JSDocTypeLiteral;
|
||||
}
|
||||
|
||||
export interface JSDocCallbackTag extends JSDocTag, NamedDeclaration {
|
||||
@@ -2392,7 +2392,7 @@ namespace ts {
|
||||
kind: SyntaxKind.JSDocCallbackTag;
|
||||
fullName?: JSDocNamespaceDeclaration | Identifier;
|
||||
name?: Identifier; // TODO: Not sure whether this rigamarole is needed for callback...but probably!
|
||||
signature: JSDocSignature;
|
||||
type: JSDocSignature;
|
||||
}
|
||||
|
||||
// TODO: Could just try to reuse JSDocTypeLiteral
|
||||
|
||||
Reference in New Issue
Block a user