Skip to content

Index signature & iterators #2862

Closed
Closed
@jbondc

Description

@jbondc
interface Files {
    [key: number]: SomeFile
    length: number
}
var data: Files = []
// no complaints
for (var i in data) {
}

// Type 'Files' is not an array type or a string type
for (let file of data) {
}

I'm not sure what is the right move here. Files has an index but that doesn't mean it's iterable/enumerable. Think the check should just be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn idea for TypeScriptToo ComplexAn issue which adding support for may be too complex for the value it adds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions