function createRecord<T extends string>(key: T): Record<T, string> {
return { [key]: 'asdf' };
}
Encountering an issue:
The type '{ [x: string]: string; }' is not matching with the expected 'Record<T, string>' type. ts(2322)
Looking for a solution to resolve the error and activate auto-completion on the outcome object.
Note: Avoiding the use of
return { [key]: 'asdf' } as Record<T, string>