Skip to content

Commit a71879c

Browse files
authored
Merge pull request #14418 from ajafff/fix-parent-type
Fix parent type of JsxAttributes
2 parents 4a1cf5d + eb8972d commit a71879c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/compiler/types.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -815,18 +815,21 @@ namespace ts {
815815

816816
export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
817817
kind: SyntaxKind.Constructor;
818+
parent?: ClassDeclaration | ClassExpression;
818819
body?: FunctionBody;
819820
}
820821

821822
// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
822823
export interface SemicolonClassElement extends ClassElement {
823824
kind: SyntaxKind.SemicolonClassElement;
825+
parent?: ClassDeclaration | ClassExpression;
824826
}
825827

826828
// See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a
827829
// ClassElement and an ObjectLiteralElement.
828830
export interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
829831
kind: SyntaxKind.GetAccessor;
832+
parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression;
830833
name: PropertyName;
831834
body: FunctionBody;
832835
}
@@ -835,6 +838,7 @@ namespace ts {
835838
// ClassElement and an ObjectLiteralElement.
836839
export interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
837840
kind: SyntaxKind.SetAccessor;
841+
parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression;
838842
name: PropertyName;
839843
body: FunctionBody;
840844
}
@@ -843,6 +847,7 @@ namespace ts {
843847

844848
export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement {
845849
kind: SyntaxKind.IndexSignature;
850+
parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode;
846851
}
847852

848853
export interface TypeNode extends Node {
@@ -937,6 +942,7 @@ namespace ts {
937942

938943
export interface MappedTypeNode extends TypeNode, Declaration {
939944
kind: SyntaxKind.MappedType;
945+
parent?: TypeAliasDeclaration;
940946
readonlyToken?: ReadonlyToken;
941947
typeParameter: TypeParameterDeclaration;
942948
questionToken?: QuestionToken;
@@ -1450,7 +1456,7 @@ namespace ts {
14501456
kind: SyntaxKind.NewExpression;
14511457
expression: LeftHandSideExpression;
14521458
typeArguments?: NodeArray<TypeNode>;
1453-
arguments: NodeArray<Expression>;
1459+
arguments?: NodeArray<Expression>;
14541460
}
14551461

14561462
export interface TaggedTemplateExpression extends MemberExpression {
@@ -1504,6 +1510,7 @@ namespace ts {
15041510
export type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression;
15051511

15061512
export interface JsxAttributes extends ObjectLiteralExpressionBase<JsxAttributeLike> {
1513+
parent?: JsxOpeningLikeElement;
15071514
}
15081515

15091516
/// The opening element of a <Tag>...</Tag> JsxElement
@@ -1523,15 +1530,15 @@ namespace ts {
15231530

15241531
export interface JsxAttribute extends ObjectLiteralElement {
15251532
kind: SyntaxKind.JsxAttribute;
1526-
parent?: JsxOpeningLikeElement;
1533+
parent?: JsxAttributes;
15271534
name: Identifier;
15281535
/// JSX attribute initializers are optional; <X y /> is sugar for <X y={true} />
15291536
initializer?: StringLiteral | JsxExpression;
15301537
}
15311538

15321539
export interface JsxSpreadAttribute extends ObjectLiteralElement {
15331540
kind: SyntaxKind.JsxSpreadAttribute;
1534-
parent?: JsxOpeningLikeElement;
1541+
parent?: JsxAttributes;
15351542
expression: Expression;
15361543
}
15371544

@@ -1777,7 +1784,7 @@ namespace ts {
17771784
kind: SyntaxKind.HeritageClause;
17781785
parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression;
17791786
token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword;
1780-
types?: NodeArray<ExpressionWithTypeArguments>;
1787+
types: NodeArray<ExpressionWithTypeArguments>;
17811788
}
17821789

17831790
export interface TypeAliasDeclaration extends DeclarationStatement {

0 commit comments

Comments
 (0)