IndexInfo#declaration is always an IndexSignatureDeclaration (#23232)

This commit is contained in:
Andy 2018-04-06 16:20:45 -07:00 committed by GitHub
parent c4788f9198
commit e0dbdad22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -7200,15 +7200,15 @@ namespace ts {
return symbol.members.get(InternalSymbolName.Index);
}
function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): SignatureDeclaration {
function getIndexDeclarationOfSymbol(symbol: Symbol, kind: IndexKind): IndexSignatureDeclaration {
const syntaxKind = kind === IndexKind.Number ? SyntaxKind.NumberKeyword : SyntaxKind.StringKeyword;
const indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (const decl of indexSymbol.declarations) {
const node = <SignatureDeclaration>decl;
const node = cast(decl, isIndexSignatureDeclaration);
if (node.parameters.length === 1) {
const parameter = node.parameters[0];
if (parameter && parameter.type && parameter.type.kind === syntaxKind) {
if (parameter.type && parameter.type.kind === syntaxKind) {
return node;
}
}
@ -7218,7 +7218,7 @@ namespace ts {
return undefined;
}
function createIndexInfo(type: Type, isReadonly: boolean, declaration?: SignatureDeclaration): IndexInfo {
function createIndexInfo(type: Type, isReadonly: boolean, declaration?: IndexSignatureDeclaration): IndexInfo {
return { type, isReadonly, declaration };
}

View File

@ -3968,7 +3968,7 @@ namespace ts {
export interface IndexInfo {
type: Type;
isReadonly: boolean;
declaration?: SignatureDeclaration;
declaration?: IndexSignatureDeclaration;
}
/* @internal */

View File

@ -2249,7 +2249,7 @@ declare namespace ts {
interface IndexInfo {
type: Type;
isReadonly: boolean;
declaration?: SignatureDeclaration;
declaration?: IndexSignatureDeclaration;
}
enum InferencePriority {
NakedTypeVariable = 1,

View File

@ -2249,7 +2249,7 @@ declare namespace ts {
interface IndexInfo {
type: Type;
isReadonly: boolean;
declaration?: SignatureDeclaration;
declaration?: IndexSignatureDeclaration;
}
enum InferencePriority {
NakedTypeVariable = 1,