Closed
Description
TypeScript Version: 3.6.0-dev.20190602
Search Terms:
generics, indexed types
Code
function foo<E extends {[key: string]: string}>(e: E) {
e['a'] = 'a';
}
Expected behavior:
you should be able to index the e
function parameter, as was the behavior before 3.5.
Actual behavior:
in typescript 3.5 this code results in a Type '"a"' cannot be used to index type 'E'
error.
I understand this is (probably) caused by this change #30637
But since I'm adding a constraint on the type parameter I feel like this still keeps type safety and should be a bug.
(This feels like such an obvious use case I figured there has to be an issue already open or closed and I was really hesitant on opening this issue, but I couldn't find any. If it's a duplicate, sorry...)
Metadata
Metadata
Assignees
Labels
No labels