Skip to content

Compiler crash when index type not found #12572

Closed
@ovangle

Description

@ovangle

TypeScript Version: 2.1.1

Code

Compile the following file, with the compiler flag -d

export interface Test {
   [index: TypeNotFound]: any;
}

Expected behavior:

The following errors get printed to console, (errors copied from compiling without -d flag).

test.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'.
test.ts(3,13): error TS2304: Cannot find name 'TypeNotFound'.

Actual behavior:
The compiler crashes with the following stack trace

Error: Debug Failure. False expression: This is unknown parent for parameter: 154
    at Object.assert (/usr/local/lib/node_modules/typescript/lib/tsc.js:1697:23)
    at Object.fail (/usr/local/lib/node_modules/typescript/lib/tsc.js:1702:19)
    at getParameterDeclarationTypeVisibilityDiagnosticMessage (/usr/local/lib/node_modules/typescript/lib/tsc.js:44696:34)
    at Object.getParameterDeclarationTypeVisibilityError [as getSymbolAccessibilityDiagnostic] (/usr/local/lib/node_modules/typescript/lib/tsc.js:44643:41)
    at handleSymbolAccessibilityError (/usr/local/lib/node_modules/typescript/lib/tsc.js:43565:40)
    at emitEntityName (/usr/local/lib/node_modules/typescript/lib/tsc.js:43699:17)
    at emitTypeReference (/usr/local/lib/node_modules/typescript/lib/tsc.js:43715:17)
    at emitType (/usr/local/lib/node_modules/typescript/lib/tsc.js:43660:28)
    at writeTypeOfDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:43590:17)
    at emitParameterDeclaration (/usr/local/lib/node_modules/typescript/lib/tsc.js:44640:17)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions