Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
deepkolos opened this issue Dec 6, 2019 · 1 comment
Closed

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

deepkolos opened this issue Dec 6, 2019 · 1 comment

Comments

@deepkolos
Copy link

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:

@deepkolos
Copy link
Author

#24220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant