Skip to content

Under-constrained mapped type key #9259

@hurrymaplelad

Description

@hurrymaplelad

Flow version: v0.261.2 & TryFlow master

type Definitions = $ReadOnly<{
    a: {type: 'a'},
    b: {type: 'b'}
}>;

type Mapped = $ReadOnly<{
    [K in keyof Definitions]: component(
        ...Definitions[K] // Boom! Flow doesn't like this lookup
    ),
}>;

Expected behavior

Type mapping works

Actual behavior

Cannot access KonDefinitions because mixed [1] is incompatible with string [2]. [incompatible-type]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions