You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search Terms:Type cannot be used to index intersectionType cannot be used to index
Code
interfaceI{a: 1}functionfoo<Textendsstring>(o: I&Record<T,number>,k: T){o[k]// Type 'T' cannot be used to index type 'I & Record<T, number>'.}// the following work:functionfoo2<Textendsstring>(o: Record<T,number>,k: T){o[k]}// same result, but T different:functionbar<TextendsRecord<string,number>>(o: I&T,k: keyofT){o[k]}
Expected behavior:
No errors. Actual behavior:
Error.
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.8.0-dev.20180302
Search Terms:
Type cannot be used to index intersection
Type cannot be used to index
Code
Expected behavior:
No errors.
Actual behavior:
Error.
Playground Link: playground
Related Issues:
There's #18538, but that seems to be an issue with
keyof
, which isn't an used here.The text was updated successfully, but these errors were encountered: