From e4d310be5c8efe6af03e7f688de3c8157a8894f1 Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Tue, 23 Oct 2018 17:17:04 -0700 Subject: [PATCH] Correct return type for getLocFromIndex --- types/eslint/eslint-tests.ts | 4 +++- types/eslint/index.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index b0c3c1966d..c6b8b786fa 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -62,7 +62,9 @@ sourceCode.getNodeByRangeIndex(0); sourceCode.isSpaceBetweenTokens(TOKEN, TOKEN); -sourceCode.getLocFromIndex(0); +const loc = sourceCode.getLocFromIndex(0); +loc.line; // $ExpectType number +loc.column; // $ExpectType number sourceCode.getIndexFromLoc({ line: 0, column: 0 }); diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index 031ab984f7..451477af40 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -136,7 +136,7 @@ export class SourceCode { isSpaceBetweenTokens(first: AST.Token, second: AST.Token): boolean; - getLocFromIndex(index: number): ESTree.SourceLocation; + getLocFromIndex(index: number): ESTree.Position; getIndexFromLoc(location: ESTree.Position): number;