Skip to content

Intersection types containing string cannot be used as an index #5739

Closed
@wycats

Description

@wycats
interface Marker {}

type Foo = string & Marker;

let x = {};
let y: Foo = "hello";

x[y] = 1;

The error is demonstrated in the TypeScript playground (http://goo.gl/STqLUU) and is still present as of the latest typescript@next.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions