I have run into a problem with an interface with keys defined as strings. Its property cannot be passed to a function that accepts strings types. I have reduced it to the simplest case.
interface Props {
[key: string]: any
}
function setPropInternal(prop : string, value : any) : void {}
function setProp<T extends keyof Props>(prop: T, value: Props[T]) : void {
// Why does this throw an error if key is defined as a string? (line 2)
// Error at prop:
// Argument of type 'T' is not assignable to parameter of type 'string'.
// Type 'string | number' is not assignable to type 'string'.
// Type 'number' is not assignable to type 'string'.
setPropInternal(prop, value);
}