Skip to content

Commit c6047c7

Browse files
committed
Fix: Label abstract function expression nodes (fixes eslint#80)
In newer versions of TypeScript the FunctionExpression node contains a null body. This will cause some rules to fail as they expect FunctionExpression to have a body and is defined that way in the ESTree spec.
1 parent 76c33f8 commit c6047c7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/ast-converter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,6 @@ module.exports = function(ast, extra) {
868868
// Declarations
869869

870870
case SyntaxKind.FunctionDeclaration:
871-
872871
var functionDeclarationType = "FunctionDeclaration";
873872
if (node.modifiers && node.modifiers.length) {
874873
var isDeclareFunction = node.modifiers.some(function(modifier) {
@@ -1134,6 +1133,7 @@ module.exports = function(ast, extra) {
11341133
});
11351134
if (isAbstractMethod) {
11361135
methodDefinitionType = "TSAbstractMethodDefinition";
1136+
method.type = "TSAbstractFunctionExpression";
11371137
}
11381138
}
11391139

tests/fixtures/typescript/basics/abstract-class-with-abstract-method.result.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module.exports = {
8989
"name": "createSocket"
9090
},
9191
"value": {
92-
"type": "FunctionExpression",
92+
"type": "TSAbstractFunctionExpression",
9393
"id": null,
9494
"generator": false,
9595
"expression": false,

0 commit comments

Comments
 (0)