Skip to content

Regression - able to use union containing non-indexing type as index #26714

Description

TypeScript Version: master at bd40583

Search Terms: array index union error

Code

declareconstarr1: (string|string[])[];declareconstarr2: number[];constj=arr2[arr1[0]];

Expected behavior: Error - Type string[] cannot be used as an index type

Actual behavior: No error

Playground Link:Link

Related Issues: Regressed during fix of #26409 (edit: #26281 ?)

Metadata

Metadata

Labels

BugA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions