Throw error if TypeScript class has empty implements (#9292)

This commit is contained in:
Brian Ng
2019-01-07 15:27:27 -06:00
committed by GitHub
parent 9803253363
commit 03022d169e
9 changed files with 129 additions and 4 deletions

View File

@@ -0,0 +1,2 @@
interface foo extends {
}

View File

@@ -0,0 +1,3 @@
{
"throws": "'extends' list cannot be empty. (1:22)"
}

View File

@@ -0,0 +1,2 @@
class Foo extends Bar implements {
}

View File

@@ -0,0 +1,3 @@
{
"throws": "'implements' list cannot be empty. (1:33)"
}

View File

@@ -0,0 +1,2 @@
class Foo implements {
}

View File

@@ -0,0 +1,3 @@
{
"throws": "'implements' list cannot be empty. (1:21)"
}

View File

@@ -0,0 +1 @@
foo<>()

View File

@@ -0,0 +1,99 @@
{
"type": "File",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"program": {
"type": "Program",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"expression": {
"type": "CallExpression",
"start": 0,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 7
}
},
"callee": {
"type": "Identifier",
"start": 0,
"end": 3,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
},
"identifierName": "foo"
},
"name": "foo"
},
"arguments": [],
"typeParameters": {
"type": "TSTypeParameterInstantiation",
"start": 3,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 5
}
},
"params": []
}
}
}
],
"directives": []
}
}