Skip to content

[key in 'a' | 'b'] is not available in interface's root #35536

Closed
@deepkolos

Description

@deepkolos

TypeScript Version: 3.7.2

Code

type a = 'a' | 'b' | 'c'

interface test {
    [k in a]: any; // it doesn't works
    b: {
        [k in a]: any; // it works
    }
}

Expected behavior: in operator works under interface's root

Actual behavior: it doesn't works

Playground Link: https://www.typescriptlang.org/play/index.html?ssl=8&ssc=2&pln=1&pc=1#code/C4TwDgpgBAhlC8UDkMlQD7IEZs0gxkgFBECWAdsBAE4BmM+0VAzsFAN5FTdQDaA1lAqwAugC5Y5EAG4uPLBM49lfQcJjjJMudwC+RXUA

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions