From 1511dd9c241cf4f0f85fddaa2ebb5840ee27f16e Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Thu, 2 Mar 2017 17:43:02 +0100 Subject: [PATCH 1/4] Fix parent type of JsxAttributes --- src/compiler/types.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 759d3cd41eb..42b8a140e4b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1504,6 +1504,7 @@ namespace ts { export type JsxTagNameExpression = PrimaryExpression | PropertyAccessExpression; export interface JsxAttributes extends ObjectLiteralExpressionBase { + parent?: JsxOpeningLikeElement; } /// The opening element of a ... JsxElement @@ -1523,7 +1524,7 @@ namespace ts { export interface JsxAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxAttribute; - parent?: JsxOpeningLikeElement; + parent?: JsxAttributes; name: Identifier; /// JSX attribute initializers are optional; is sugar for initializer?: StringLiteral | JsxExpression; @@ -1531,7 +1532,7 @@ namespace ts { export interface JsxSpreadAttribute extends ObjectLiteralElement { kind: SyntaxKind.JsxSpreadAttribute; - parent?: JsxOpeningLikeElement; + parent?: JsxAttributes; expression: Expression; } From 6e086980a4955d2b539d61ba00ddd40afa0e0413 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Mon, 20 Mar 2017 22:07:15 +0100 Subject: [PATCH 2/4] Also fix type of NewExpression#arguments --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 42b8a140e4b..6a42c57cd64 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1450,7 +1450,7 @@ namespace ts { kind: SyntaxKind.NewExpression; expression: LeftHandSideExpression; typeArguments?: NodeArray; - arguments: NodeArray; + arguments?: NodeArray; } export interface TaggedTemplateExpression extends MemberExpression { From fcca27c03eb11d45691433b9fcaf60d94e118f13 Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Tue, 21 Mar 2017 20:21:43 +0100 Subject: [PATCH 3/4] Fix type of HeritageClause#types --- src/compiler/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6a42c57cd64..ba383ed1bce 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1778,7 +1778,7 @@ namespace ts { kind: SyntaxKind.HeritageClause; parent?: InterfaceDeclaration | ClassDeclaration | ClassExpression; token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword; - types?: NodeArray; + types: NodeArray; } export interface TypeAliasDeclaration extends DeclarationStatement { From eb8972d5ff9eec8dc3ad9c29a8d4b57fb6d0533b Mon Sep 17 00:00:00 2001 From: Klaus Meinhardt Date: Wed, 22 Mar 2017 15:28:51 +0100 Subject: [PATCH 4/4] Add parent types to class elements --- src/compiler/types.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ba383ed1bce..78425c9eac5 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -815,18 +815,21 @@ namespace ts { export interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement { kind: SyntaxKind.Constructor; + parent?: ClassDeclaration | ClassExpression; body?: FunctionBody; } // For when we encounter a semicolon in a class declaration. ES6 allows these as class elements. export interface SemicolonClassElement extends ClassElement { kind: SyntaxKind.SemicolonClassElement; + parent?: ClassDeclaration | ClassExpression; } // See the comment on MethodDeclaration for the intuition behind GetAccessorDeclaration being a // ClassElement and an ObjectLiteralElement. export interface GetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.GetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } @@ -835,6 +838,7 @@ namespace ts { // ClassElement and an ObjectLiteralElement. export interface SetAccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement { kind: SyntaxKind.SetAccessor; + parent?: ClassDeclaration | ClassExpression | ObjectLiteralExpression; name: PropertyName; body: FunctionBody; } @@ -843,6 +847,7 @@ namespace ts { export interface IndexSignatureDeclaration extends SignatureDeclaration, ClassElement, TypeElement { kind: SyntaxKind.IndexSignature; + parent?: ClassDeclaration | ClassExpression | InterfaceDeclaration | TypeLiteralNode; } export interface TypeNode extends Node { @@ -937,6 +942,7 @@ namespace ts { export interface MappedTypeNode extends TypeNode, Declaration { kind: SyntaxKind.MappedType; + parent?: TypeAliasDeclaration; readonlyToken?: ReadonlyToken; typeParameter: TypeParameterDeclaration; questionToken?: QuestionToken;