File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
packages/typescript-estree/src Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -801,12 +801,11 @@ export class Converter {
801
801
802
802
case SyntaxKind . Identifier : {
803
803
if ( isThisInTypeQuery ( node ) ) {
804
- return this . createNode < TSESTree . ThisExpression > (
805
- node as unknown as ts . ThisExpression ,
806
- {
807
- type : AST_NODE_TYPES . ThisExpression ,
808
- } ,
809
- ) ;
804
+ // special case for `typeof this.foo` - TS emits an Identifier for `this`
805
+ // but we want to treat it as a ThisExpression for consistency
806
+ return this . createNode < TSESTree . ThisExpression > ( node , {
807
+ type : AST_NODE_TYPES . ThisExpression ,
808
+ } ) ;
810
809
}
811
810
return this . createNode < TSESTree . Identifier > ( node , {
812
811
type : AST_NODE_TYPES . Identifier ,
Original file line number Diff line number Diff line change @@ -149,7 +149,10 @@ export interface EstreeToTsNodeTypes {
149
149
[ AST_NODE_TYPES . TemplateLiteral ] :
150
150
| ts . NoSubstitutionTemplateLiteral
151
151
| ts . TemplateExpression ;
152
- [ AST_NODE_TYPES . ThisExpression ] : ts . ThisExpression | ts . KeywordTypeNode ;
152
+ [ AST_NODE_TYPES . ThisExpression ] :
153
+ | ts . ThisExpression
154
+ | ts . KeywordTypeNode
155
+ | ts . Identifier ;
153
156
[ AST_NODE_TYPES . ThrowStatement ] : ts . ThrowStatement ;
154
157
[ AST_NODE_TYPES . TryStatement ] : ts . TryStatement ;
155
158
[ AST_NODE_TYPES . TSAbstractPropertyDefinition ] : ts . PropertyDeclaration ;
You can’t perform that action at this time.
0 commit comments