I'm looking to have a generic class like this one:
export abstract class Foo<ID extends keyof T, T> {
bar(T t) {
const s: string = t[ID];
}
}
Obviously the code above can't infer the type of t[ID]
and we're getting an implicit any
.
How can I enforce using generics T[ID]
will be a string
?