Skip to content

Commit 7d2233a

Browse files
committed
Rename typeExpression to type (for some jsdoc)
(maybe I'll rename more later)
1 parent ec7ddf8 commit 7d2233a

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5357,9 +5357,8 @@ namespace ts {
53575357

53585358
const declaration = <JSDocTypedefTag | JSDocCallbackTag | TypeAliasDeclaration>find(symbol.declarations, d =>
53595359
isJSDocTypeAlias(d) || d.kind === SyntaxKind.TypeAliasDeclaration);
5360-
const typeNode = isJSDocTypedefTag(declaration) ? declaration.typeExpression : isJSDocCallbackTag(declaration) ? declaration.signature : declaration.type;
53615360
// If typeNode is missing, we will error in checkJSDocTypedefTag.
5362-
let type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType;
5361+
let type = declaration.type ? getTypeFromTypeNode(declaration.type) : unknownType;
53635362

53645363
if (popTypeResolution()) {
53655364
const typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
@@ -22147,15 +22146,15 @@ namespace ts {
2214722146
}
2214822147

2214922148
function checkJSDocTypedefTag(node: JSDocTypedefTag) {
22150-
if (!node.typeExpression) {
22149+
if (!node.type) {
2215122150
// If the node had `@property` tags, `typeExpression` would have been set to the first property tag.
2215222151
error(node.name, Diagnostics.JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags);
2215322152
}
2215422153

2215522154
if (node.name) {
2215622155
checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
2215722156
}
22158-
checkSourceElement(node.typeExpression);
22157+
checkSourceElement(node.type);
2215922158
}
2216022159

2216122160
function checkJSDocParameterTag(node: JSDocParameterTag) {

src/compiler/parser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -480,18 +480,18 @@ namespace ts {
480480
case SyntaxKind.JSDocTemplateTag:
481481
return visitNodes(cbNode, cbNodes, (<JSDocTemplateTag>node).typeParameters);
482482
case SyntaxKind.JSDocTypedefTag:
483-
if ((node as JSDocTypedefTag).typeExpression &&
484-
(node as JSDocTypedefTag).typeExpression.kind === SyntaxKind.JSDocTypeExpression) {
485-
return visitNode(cbNode, (<JSDocTypedefTag>node).typeExpression) ||
483+
if ((node as JSDocTypedefTag).type &&
484+
(node as JSDocTypedefTag).type.kind === SyntaxKind.JSDocTypeExpression) {
485+
return visitNode(cbNode, (<JSDocTypedefTag>node).type) ||
486486
visitNode(cbNode, (<JSDocTypedefTag>node).fullName);
487487
}
488488
else {
489489
return visitNode(cbNode, (<JSDocTypedefTag>node).fullName) ||
490-
visitNode(cbNode, (<JSDocTypedefTag>node).typeExpression);
490+
visitNode(cbNode, (<JSDocTypedefTag>node).type);
491491
}
492492
case SyntaxKind.JSDocCallbackTag:
493493
return visitNode(cbNode, (node as JSDocCallbackTag).fullName) ||
494-
visitNode(cbNode, (node as JSDocCallbackTag).signature);
494+
visitNode(cbNode, (node as JSDocCallbackTag).type);
495495
case SyntaxKind.JSDocSignature:
496496
return visitNodes(cbNode, cbNodes, node.decorators) ||
497497
visitNodes(cbNode, cbNodes, node.modifiers) ||
@@ -6737,7 +6737,7 @@ namespace ts {
67376737
// Debug.assert(child.kind !== SyntaxKind.JSDocTypeTag);
67386738
jsdocSignature.parameters = append(jsdocSignature.parameters as MutableNodeArray<JSDocParameterTag>, child);
67396739
}
6740-
callbackTag.signature = finishNode(jsdocSignature);
6740+
callbackTag.type = finishNode(jsdocSignature);
67416741
return finishNode(callbackTag);
67426742
}
67436743

@@ -6764,7 +6764,7 @@ namespace ts {
67646764
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
67656765
skipWhitespace();
67666766

6767-
typedefTag.typeExpression = typeExpression;
6767+
typedefTag.type = typeExpression;
67686768
if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) {
67696769
let child: JSDocTypeTag | JSDocPropertyTag | false;
67706770
let jsdocTypeLiteral: JSDocTypeLiteral;
@@ -6790,7 +6790,7 @@ namespace ts {
67906790
if (typeExpression && typeExpression.type.kind === SyntaxKind.ArrayType) {
67916791
jsdocTypeLiteral.isArrayType = true;
67926792
}
6793-
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
6793+
typedefTag.type = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
67946794
childTypeTag.typeExpression :
67956795
finishNode(jsdocTypeLiteral);
67966796
}

src/compiler/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,15 +2384,15 @@ namespace ts {
23842384
kind: SyntaxKind.JSDocTypedefTag;
23852385
fullName?: JSDocNamespaceDeclaration | Identifier;
23862386
name?: Identifier;
2387-
typeExpression?: JSDocTypeExpression | JSDocTypeLiteral;
2387+
type?: JSDocTypeExpression | JSDocTypeLiteral;
23882388
}
23892389

23902390
export interface JSDocCallbackTag extends JSDocTag, NamedDeclaration {
23912391
parent: JSDoc;
23922392
kind: SyntaxKind.JSDocCallbackTag;
23932393
fullName?: JSDocNamespaceDeclaration | Identifier;
23942394
name?: Identifier; // TODO: Not sure whether this rigamarole is needed for callback...but probably!
2395-
signature: JSDocSignature;
2395+
type: JSDocSignature;
23962396
}
23972397

23982398
// TODO: Could just try to reuse JSDocTypeLiteral

0 commit comments

Comments
 (0)