Skip to content

Commit ca8d298

Browse files
committed
Rename type
1 parent 0ec5d93 commit ca8d298

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/compiler/types.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ namespace ts {
526526
/* @internal */ contextualMapper?: TypeMapper; // Mapper for contextual type
527527
}
528528

529-
export interface HasJSDocNodes {
529+
export interface JSDocContainer {
530530
/* @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node
531531
/* @internal */ jsDocCache?: ReadonlyArray<JSDocTag>; // Cache for getJSDocTags
532532
}
@@ -582,7 +582,7 @@ namespace ts {
582582
export type EqualsToken = Token<SyntaxKind.EqualsToken>;
583583
export type AsteriskToken = Token<SyntaxKind.AsteriskToken>;
584584
export type EqualsGreaterThanToken = Token<SyntaxKind.EqualsGreaterThanToken>;
585-
export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & HasJSDocNodes;
585+
export type EndOfFileToken = Token<SyntaxKind.EndOfFileToken> & JSDocContainer;
586586
export type AtToken = Token<SyntaxKind.AtToken>;
587587
export type ReadonlyToken = Token<SyntaxKind.ReadonlyKeyword>;
588588
export type AwaitKeywordToken = Token<SyntaxKind.AwaitKeyword>;
@@ -687,7 +687,7 @@ namespace ts {
687687
expression?: Expression;
688688
}
689689

690-
export interface SignatureDeclarationBase extends NamedDeclaration, HasJSDocNodes {
690+
export interface SignatureDeclarationBase extends NamedDeclaration, JSDocContainer {
691691
kind: SignatureDeclaration["kind"];
692692
name?: PropertyName;
693693
typeParameters?: NodeArray<TypeParameterDeclaration>;
@@ -734,7 +734,7 @@ namespace ts {
734734
declarations: NodeArray<VariableDeclaration>;
735735
}
736736

737-
export interface ParameterDeclaration extends NamedDeclaration, HasJSDocNodes {
737+
export interface ParameterDeclaration extends NamedDeclaration, JSDocContainer {
738738
kind: SyntaxKind.Parameter;
739739
parent?: SignatureDeclaration;
740740
dotDotDotToken?: DotDotDotToken; // Present on rest parameter
@@ -753,15 +753,15 @@ namespace ts {
753753
initializer?: Expression; // Optional initializer
754754
}
755755

756-
export interface PropertySignature extends TypeElement, HasJSDocNodes {
756+
export interface PropertySignature extends TypeElement, JSDocContainer {
757757
kind: SyntaxKind.PropertySignature;
758758
name: PropertyName; // Declared property name
759759
questionToken?: QuestionToken; // Present on optional property
760760
type?: TypeNode; // Optional type annotation
761761
initializer?: Expression; // Optional initializer
762762
}
763763

764-
export interface PropertyDeclaration extends ClassElement, HasJSDocNodes {
764+
export interface PropertyDeclaration extends ClassElement, JSDocContainer {
765765
kind: SyntaxKind.PropertyDeclaration;
766766
questionToken?: QuestionToken; // Present for use with reporting a grammar error
767767
name: PropertyName;
@@ -782,15 +782,15 @@ namespace ts {
782782
| AccessorDeclaration
783783
;
784784

785-
export interface PropertyAssignment extends ObjectLiteralElement, HasJSDocNodes {
785+
export interface PropertyAssignment extends ObjectLiteralElement, JSDocContainer {
786786
parent: ObjectLiteralExpression;
787787
kind: SyntaxKind.PropertyAssignment;
788788
name: PropertyName;
789789
questionToken?: QuestionToken;
790790
initializer: Expression;
791791
}
792792

793-
export interface ShorthandPropertyAssignment extends ObjectLiteralElement, HasJSDocNodes {
793+
export interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer {
794794
parent: ObjectLiteralExpression;
795795
kind: SyntaxKind.ShorthandPropertyAssignment;
796796
name: Identifier;
@@ -801,7 +801,7 @@ namespace ts {
801801
objectAssignmentInitializer?: Expression;
802802
}
803803

804-
export interface SpreadAssignment extends ObjectLiteralElement, HasJSDocNodes {
804+
export interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer {
805805
parent: ObjectLiteralExpression;
806806
kind: SyntaxKind.SpreadAssignment;
807807
expression: Expression;
@@ -899,13 +899,13 @@ namespace ts {
899899
// Because of this, it may be necessary to determine what sort of MethodDeclaration you have
900900
// at later stages of the compiler pipeline. In that case, you can either check the parent kind
901901
// of the method, or use helpers like isObjectLiteralMethodDeclaration
902-
export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, HasJSDocNodes {
902+
export interface MethodDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
903903
kind: SyntaxKind.MethodDeclaration;
904904
name: PropertyName;
905905
body?: FunctionBody;
906906
}
907907

908-
export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, HasJSDocNodes {
908+
export interface ConstructorDeclaration extends FunctionLikeDeclarationBase, ClassElement, JSDocContainer {
909909
kind: SyntaxKind.Constructor;
910910
parent?: ClassDeclaration | ClassExpression;
911911
body?: FunctionBody;
@@ -919,7 +919,7 @@ namespace ts {
919919

920920
// See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a
921921
// ClassElement and an ObjectLiteralElement.
922-
export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, HasJSDocNodes {
922+
export interface GetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
923923
kind: SyntaxKind.GetAccessor;
924924
parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression;
925925
name: PropertyName;
@@ -928,7 +928,7 @@ namespace ts {
928928

929929
// See the comment on MethodDeclaration for the intuition behind SetAccessorDeclaration being a
930930
// ClassElement and an ObjectLiteralElement.
931-
export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, HasJSDocNodes {
931+
export interface SetAccessorDeclaration extends FunctionLikeDeclarationBase, ClassElement, ObjectLiteralElement, JSDocContainer {
932932
kind: SyntaxKind.SetAccessor;
933933
parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression;
934934
name: PropertyName;
@@ -1393,13 +1393,13 @@ namespace ts {
13931393
export type FunctionBody = Block;
13941394
export type ConciseBody = FunctionBody | Expression;
13951395

1396-
export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, HasJSDocNodes {
1396+
export interface FunctionExpression extends PrimaryExpression, FunctionLikeDeclarationBase, JSDocContainer {
13971397
kind: SyntaxKind.FunctionExpression;
13981398
name?: Identifier;
13991399
body: FunctionBody; // Required, whereas the member inherited from FunctionDeclaration is optional
14001400
}
14011401

1402-
export interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, HasJSDocNodes {
1402+
export interface ArrowFunction extends Expression, FunctionLikeDeclarationBase, JSDocContainer {
14031403
kind: SyntaxKind.ArrowFunction;
14041404
equalsGreaterThanToken: EqualsGreaterThanToken;
14051405
body: ConciseBody;
@@ -1478,7 +1478,7 @@ namespace ts {
14781478
literal: TemplateMiddle | TemplateTail;
14791479
}
14801480

1481-
export interface ParenthesizedExpression extends PrimaryExpression, HasJSDocNodes {
1481+
export interface ParenthesizedExpression extends PrimaryExpression, JSDocContainer {
14821482
kind: SyntaxKind.ParenthesizedExpression;
14831483
expression: Expression;
14841484
}
@@ -1734,12 +1734,12 @@ namespace ts {
17341734
/*@internal*/ multiLine?: boolean;
17351735
}
17361736

1737-
export interface VariableStatement extends Statement, HasJSDocNodes {
1737+
export interface VariableStatement extends Statement, JSDocContainer {
17381738
kind: SyntaxKind.VariableStatement;
17391739
declarationList: VariableDeclarationList;
17401740
}
17411741

1742-
export interface ExpressionStatement extends Statement, HasJSDocNodes {
1742+
export interface ExpressionStatement extends Statement, JSDocContainer {
17431743
kind: SyntaxKind.ExpressionStatement;
17441744
expression: Expression;
17451745
}
@@ -1845,7 +1845,7 @@ namespace ts {
18451845

18461846
export type CaseOrDefaultClause = CaseClause | DefaultClause;
18471847

1848-
export interface LabeledStatement extends Statement, HasJSDocNodes {
1848+
export interface LabeledStatement extends Statement, JSDocContainer {
18491849
kind: SyntaxKind.LabeledStatement;
18501850
label: Identifier;
18511851
statement: Statement;
@@ -1872,7 +1872,7 @@ namespace ts {
18721872

18731873
export type DeclarationWithTypeParameters = SignatureDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTemplateTag;
18741874

1875-
export interface ClassLikeDeclarationBase extends NamedDeclaration, HasJSDocNodes {
1875+
export interface ClassLikeDeclarationBase extends NamedDeclaration, JSDocContainer {
18761876
kind: SyntaxKind.ClassDeclaration | SyntaxKind.ClassExpression;
18771877
name?: Identifier;
18781878
typeParameters?: NodeArray<TypeParameterDeclaration>;
@@ -1902,7 +1902,7 @@ namespace ts {
19021902
questionToken?: QuestionToken;
19031903
}
19041904

1905-
export interface InterfaceDeclaration extends DeclarationStatement, HasJSDocNodes {
1905+
export interface InterfaceDeclaration extends DeclarationStatement, JSDocContainer {
19061906
kind: SyntaxKind.InterfaceDeclaration;
19071907
name: Identifier;
19081908
typeParameters?: NodeArray<TypeParameterDeclaration>;
@@ -1917,14 +1917,14 @@ namespace ts {
19171917
types: NodeArray<ExpressionWithTypeArguments>;
19181918
}
19191919

1920-
export interface TypeAliasDeclaration extends DeclarationStatement, HasJSDocNodes {
1920+
export interface TypeAliasDeclaration extends DeclarationStatement, JSDocContainer {
19211921
kind: SyntaxKind.TypeAliasDeclaration;
19221922
name: Identifier;
19231923
typeParameters?: NodeArray<TypeParameterDeclaration>;
19241924
type: TypeNode;
19251925
}
19261926

1927-
export interface EnumMember extends NamedDeclaration, HasJSDocNodes {
1927+
export interface EnumMember extends NamedDeclaration, JSDocContainer {
19281928
kind: SyntaxKind.EnumMember;
19291929
parent?: EnumDeclaration;
19301930
// This does include ComputedPropertyName, but the parser will give an error
@@ -1933,7 +1933,7 @@ namespace ts {
19331933
initializer?: Expression;
19341934
}
19351935

1936-
export interface EnumDeclaration extends DeclarationStatement, HasJSDocNodes {
1936+
export interface EnumDeclaration extends DeclarationStatement, JSDocContainer {
19371937
kind: SyntaxKind.EnumDeclaration;
19381938
name: Identifier;
19391939
members: NodeArray<EnumMember>;
@@ -1943,7 +1943,7 @@ namespace ts {
19431943

19441944
export type ModuleBody = NamespaceBody | JSDocNamespaceBody;
19451945

1946-
export interface ModuleDeclaration extends DeclarationStatement, HasJSDocNodes {
1946+
export interface ModuleDeclaration extends DeclarationStatement, JSDocContainer {
19471947
kind: SyntaxKind.ModuleDeclaration;
19481948
parent?: ModuleBody | SourceFile;
19491949
name: ModuleName;
@@ -1977,7 +1977,7 @@ namespace ts {
19771977
* - import x = require("mod");
19781978
* - import x = M.x;
19791979
*/
1980-
export interface ImportEqualsDeclaration extends DeclarationStatement, HasJSDocNodes {
1980+
export interface ImportEqualsDeclaration extends DeclarationStatement, JSDocContainer {
19811981
kind: SyntaxKind.ImportEqualsDeclaration;
19821982
parent?: SourceFile | ModuleBlock;
19831983
name: Identifier;

src/compiler/utilities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,10 +1510,10 @@ namespace ts {
15101510
}
15111511

15121512
export function getJSDocTags(node: Node): ReadonlyArray<JSDocTag> | undefined {
1513-
let tags = (node as HasJSDocNodes).jsDocCache;
1513+
let tags = (node as JSDocContainer).jsDocCache;
15141514
// If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
15151515
if (tags === undefined) {
1516-
(node as HasJSDocNodes).jsDocCache = tags = flatMap(getJSDocCommentsAndTags(node), j => isJSDoc(j) ? j.tags : j);
1516+
(node as JSDocContainer).jsDocCache = tags = flatMap(getJSDocCommentsAndTags(node), j => isJSDoc(j) ? j.tags : j);
15171517
}
15181518
return tags;
15191519
}
@@ -5433,6 +5433,6 @@ namespace ts {
54335433
/** True if has jsdoc nodes attached to it. */
54345434
/* @internal */
54355435
export function hasJSDocNodes(node: Node): node is HasJSDoc {
5436-
return !!(node as HasJSDocNodes).jsDoc && (node as HasJSDocNodes).jsDoc.length > 0;
5436+
return !!(node as JSDocContainer).jsDoc && (node as JSDocContainer).jsDoc.length > 0;
54375437
}
54385438
}

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ namespace ts.Completions {
17391739

17401740
/** Get the corresponding JSDocTag node if the position is in a jsDoc comment */
17411741
function getJsDocTagAtPosition(node: Node, position: number): JSDocTag | undefined {
1742-
const { jsDoc } = getJsDocHavingNode(node) as HasJSDocNodes;
1742+
const { jsDoc } = getJsDocHavingNode(node) as JSDocContainer;
17431743
if (!jsDoc) return undefined;
17441744

17451745
for (const { pos, end, tags } of jsDoc) {

0 commit comments

Comments
 (0)