diff --git a/packages/parser/tests/lib/__snapshots__/tsx.ts.snap b/packages/parser/tests/lib/__snapshots__/tsx.ts.snap
index 59b060335a70..0fb95a3acc74 100644
--- a/packages/parser/tests/lib/__snapshots__/tsx.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/tsx.ts.snap
@@ -50,6 +50,56 @@ Object {
}
`;
+exports[`TSX fixtures/generic-jsx-opening-element.src 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "module",
+ "upperScope": Object {
+ "$ref": 1,
+ },
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 0,
+ },
+ "variables": Array [],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [],
+}
+`;
+
exports[`TSX fixtures/react-typed-props.src 1`] = `
Object {
"$id": 7,
diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap
index eeff596aead1..a0cf4bcc5d6d 100644
--- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap
+++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap
@@ -32512,6 +32512,56 @@ Object {
}
`;
+exports[`typescript fixtures/errorRecovery/interface-method-readonly.src 1`] = `
+Object {
+ "$id": 1,
+ "block": Object {
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [
+ Object {
+ "$id": 0,
+ "block": Object {
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "type": "Program",
+ },
+ "childScopes": Array [],
+ "functionExpressionScope": false,
+ "isStrict": true,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "module",
+ "upperScope": Object {
+ "$ref": 1,
+ },
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 0,
+ },
+ "variables": Array [],
+ },
+ ],
+ "functionExpressionScope": false,
+ "isStrict": false,
+ "references": Array [],
+ "throughReferences": Array [],
+ "type": "global",
+ "upperScope": null,
+ "variableMap": Object {},
+ "variableScope": Object {
+ "$ref": 1,
+ },
+ "variables": Array [],
+}
+`;
+
exports[`typescript fixtures/errorRecovery/interface-method-static.src 1`] = `
Object {
"$id": 1,
diff --git a/packages/shared-fixtures/fixtures/tsx/generic-jsx-opening-element.src.tsx b/packages/shared-fixtures/fixtures/tsx/generic-jsx-opening-element.src.tsx
new file mode 100644
index 000000000000..fe6dfcffea8f
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/tsx/generic-jsx-opening-element.src.tsx
@@ -0,0 +1 @@
+ data={12}>
diff --git a/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-readonly.src.ts b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-readonly.src.ts
new file mode 100644
index 000000000000..ef4bf50ebae2
--- /dev/null
+++ b/packages/shared-fixtures/fixtures/typescript/errorRecovery/interface-method-readonly.src.ts
@@ -0,0 +1,3 @@
+interface Foo {
+ readonly g(bar: string): void;
+}
diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts
index 207c8aa69a5c..1663dccf1424 100644
--- a/packages/typescript-estree/src/convert.ts
+++ b/packages/typescript-estree/src/convert.ts
@@ -266,7 +266,7 @@ export class Converter {
*/
private convertBodyExpressions(
nodes: ts.NodeArray,
- parent: ts.Node,
+ parent: ts.SourceFile | ts.Block | ts.ModuleBlock,
): any[] {
let allowDirectives = canContainDirective(parent);
@@ -1183,7 +1183,7 @@ export class Converter {
} else {
return arrayItem;
}
- } else if (parent.kind === SyntaxKind.ObjectBindingPattern) {
+ } else {
let result: TSESTree.RestElement | TSESTree.Property;
if (node.dotDotDotToken) {
result = this.createNode(node, {
@@ -1215,7 +1215,6 @@ export class Converter {
}
return result;
}
- return null;
}
case SyntaxKind.ArrowFunction: {
@@ -2360,7 +2359,7 @@ export class Converter {
return this.fixExports(node, result);
}
- case SyntaxKind.FirstTypeNode: {
+ case SyntaxKind.TypePredicate: {
const result = this.createNode(node, {
type: AST_NODE_TYPES.TSTypePredicate,
parameterName: this.convertChild(node.parameterName),
diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts
index 99a8f512f11a..119fa243a4f8 100644
--- a/packages/typescript-estree/src/node-utils.ts
+++ b/packages/typescript-estree/src/node-utils.ts
@@ -255,27 +255,24 @@ export function getLocFor(
* @param node
* @returns returns true if node can contain directive
*/
-export function canContainDirective(node: ts.Node): boolean {
- switch (node.kind) {
- case ts.SyntaxKind.SourceFile:
- case ts.SyntaxKind.ModuleBlock:
- return true;
- case ts.SyntaxKind.Block:
- switch (node.parent.kind) {
- case ts.SyntaxKind.Constructor:
- case ts.SyntaxKind.GetAccessor:
- case ts.SyntaxKind.SetAccessor:
- case ts.SyntaxKind.ArrowFunction:
- case ts.SyntaxKind.FunctionExpression:
- case ts.SyntaxKind.FunctionDeclaration:
- case ts.SyntaxKind.MethodDeclaration:
- return true;
- default:
- return false;
- }
- default:
- return false;
+export function canContainDirective(
+ node: ts.SourceFile | ts.Block | ts.ModuleBlock,
+): boolean {
+ if (node.kind === ts.SyntaxKind.Block) {
+ switch (node.parent.kind) {
+ case ts.SyntaxKind.Constructor:
+ case ts.SyntaxKind.GetAccessor:
+ case ts.SyntaxKind.SetAccessor:
+ case ts.SyntaxKind.ArrowFunction:
+ case ts.SyntaxKind.FunctionExpression:
+ case ts.SyntaxKind.FunctionDeclaration:
+ case ts.SyntaxKind.MethodDeclaration:
+ return true;
+ default:
+ return false;
+ }
}
+ return true;
}
/**
diff --git a/packages/typescript-estree/src/semantic-errors.ts b/packages/typescript-estree/src/semantic-errors.ts
index b9f94bbc6825..4486532c09d9 100644
--- a/packages/typescript-estree/src/semantic-errors.ts
+++ b/packages/typescript-estree/src/semantic-errors.ts
@@ -44,7 +44,9 @@ export function getFirstSemanticOrSyntacticError(
* For our current use-cases this is undesired behavior, so we just suppress it
* and log a a warning.
*/
+ /* istanbul ignore next */
console.warn(`Warning From TSC: "${e.message}`);
+ /* istanbul ignore next */
return undefined;
}
}
diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts
index d2c2b6c4d772..7c8b4f2d5eb7 100644
--- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts
+++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts
@@ -452,6 +452,11 @@ tester.addFixturePatternConfig('typescript/errorRecovery', {
'empty-type-parameters-in-function-expression',
'empty-type-parameters-in-method',
'empty-type-parameters-in-method-signature',
+ /**
+ * Babel correctly errors on this
+ * TODO: enable error code TS1024
+ */
+ 'interface-method-readonly',
],
});
diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap
index af9d347cf9ee..733bb36fbfcc 100644
--- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap
+++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap
@@ -1621,6 +1621,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e
exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
+exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/generic-jsx-opening-element.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
+
exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/tsx/react-typed-props.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/babylon-convergence/type-parameter-whitespace-loc.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
@@ -2287,6 +2289,8 @@ Object {
}
`;
+exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-readonly.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;
+
exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/errorRecovery/interface-method-static.src 1`] = `
Object {
"column": 2,
diff --git a/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap
index 9f3a260699e0..76cb6fb260d5 100644
--- a/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap
+++ b/packages/typescript-estree/tests/lib/__snapshots__/tsx.ts.snap
@@ -422,6 +422,516 @@ Object {
}
`;
+exports[`TSX fixtures/generic-jsx-opening-element.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "expression": Object {
+ "children": Array [],
+ "closingElement": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "name": "MyComponent",
+ "range": Array [
+ 33,
+ 44,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 31,
+ 45,
+ ],
+ "type": "JSXClosingElement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "openingElement": Object {
+ "attributes": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "name": "data",
+ "range": Array [
+ 21,
+ 25,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 21,
+ 30,
+ ],
+ "type": "JSXAttribute",
+ "value": Object {
+ "expression": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 29,
+ ],
+ "raw": "12",
+ "type": "Literal",
+ "value": 12,
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 30,
+ ],
+ "type": "JSXExpressionContainer",
+ },
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "name": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "name": "MyComponent",
+ "range": Array [
+ 1,
+ 12,
+ ],
+ "type": "JSXIdentifier",
+ },
+ "range": Array [
+ 0,
+ 31,
+ ],
+ "selfClosing": false,
+ "type": "JSXOpeningElement",
+ "typeParameters": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 19,
+ ],
+ "type": "TSNumberKeyword",
+ },
+ ],
+ "range": Array [
+ 12,
+ 20,
+ ],
+ "type": "TSTypeParameterInstantiation",
+ },
+ },
+ "range": Array [
+ 0,
+ 45,
+ ],
+ "type": "JSXElement",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 45,
+ ],
+ "type": "ExpressionStatement",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 46,
+ ],
+ "sourceType": "script",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 1,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 1,
+ 12,
+ ],
+ "type": "JSXIdentifier",
+ "value": "MyComponent",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 12,
+ 13,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 13,
+ 19,
+ ],
+ "type": "Identifier",
+ "value": "number",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 19,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 19,
+ 20,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 21,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 21,
+ 25,
+ ],
+ "type": "JSXIdentifier",
+ "value": "data",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 25,
+ 26,
+ ],
+ "type": "Punctuator",
+ "value": "=",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 26,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 26,
+ 27,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 29,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 27,
+ 29,
+ ],
+ "type": "Numeric",
+ "value": "12",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 29,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 29,
+ 30,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 30,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 30,
+ 31,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 31,
+ 32,
+ ],
+ "type": "Punctuator",
+ "value": "<",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 33,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 32,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": "/",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 44,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 33,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 33,
+ 44,
+ ],
+ "type": "JSXIdentifier",
+ "value": "MyComponent",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 45,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 44,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 44,
+ 45,
+ ],
+ "type": "Punctuator",
+ "value": ">",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
exports[`TSX fixtures/react-typed-props.src 1`] = `
Object {
"body": Array [
diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap
index b9e876c45955..d8494a997ac3 100644
--- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap
+++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap
@@ -100115,6 +100115,462 @@ Object {
}
`;
+exports[`typescript fixtures/errorRecovery/interface-method-readonly.src 1`] = `
+Object {
+ "body": Array [
+ Object {
+ "body": Object {
+ "body": Array [
+ Object {
+ "computed": false,
+ "key": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "name": "g",
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "params": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "name": "bar",
+ "range": Array [
+ 29,
+ 40,
+ ],
+ "type": "Identifier",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 40,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 34,
+ 40,
+ ],
+ "type": "TSStringKeyword",
+ },
+ },
+ },
+ ],
+ "range": Array [
+ 18,
+ 48,
+ ],
+ "readonly": true,
+ "returnType": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 41,
+ 47,
+ ],
+ "type": "TSTypeAnnotation",
+ "typeAnnotation": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 43,
+ 47,
+ ],
+ "type": "TSVoidKeyword",
+ },
+ },
+ "type": "TSMethodSignature",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 50,
+ ],
+ "type": "TSInterfaceBody",
+ },
+ "id": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "name": "Foo",
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ },
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 50,
+ ],
+ "type": "TSInterfaceDeclaration",
+ },
+ ],
+ "loc": Object {
+ "end": Object {
+ "column": 0,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 51,
+ ],
+ "sourceType": "script",
+ "tokens": Array [
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 9,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 0,
+ 9,
+ ],
+ "type": "Keyword",
+ "value": "interface",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 10,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 10,
+ 13,
+ ],
+ "type": "Identifier",
+ "value": "Foo",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 15,
+ "line": 1,
+ },
+ "start": Object {
+ "column": 14,
+ "line": 1,
+ },
+ },
+ "range": Array [
+ 14,
+ 15,
+ ],
+ "type": "Punctuator",
+ "value": "{",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 10,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 18,
+ 26,
+ ],
+ "type": "Identifier",
+ "value": "readonly",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 12,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 11,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 27,
+ 28,
+ ],
+ "type": "Identifier",
+ "value": "g",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 13,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 12,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 28,
+ 29,
+ ],
+ "type": "Punctuator",
+ "value": "(",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 16,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 13,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 29,
+ 32,
+ ],
+ "type": "Identifier",
+ "value": "bar",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 17,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 16,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 32,
+ 33,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 18,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 34,
+ 40,
+ ],
+ "type": "Identifier",
+ "value": "string",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 24,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 40,
+ 41,
+ ],
+ "type": "Punctuator",
+ "value": ")",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 25,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 41,
+ 42,
+ ],
+ "type": "Punctuator",
+ "value": ":",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 27,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 43,
+ 47,
+ ],
+ "type": "Keyword",
+ "value": "void",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 32,
+ "line": 2,
+ },
+ "start": Object {
+ "column": 31,
+ "line": 2,
+ },
+ },
+ "range": Array [
+ 47,
+ 48,
+ ],
+ "type": "Punctuator",
+ "value": ";",
+ },
+ Object {
+ "loc": Object {
+ "end": Object {
+ "column": 1,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "range": Array [
+ 49,
+ 50,
+ ],
+ "type": "Punctuator",
+ "value": "}",
+ },
+ ],
+ "type": "Program",
+}
+`;
+
exports[`typescript fixtures/errorRecovery/interface-method-static.src 1`] = `
Object {
"body": Array [