I met some code like
type Value = {
[name: string]: string;
};
function foo(a: Value) {
console.log(a);
}
foo({ name: "foo" }); //ok
foo("hello world"); //error
It's easy to see that Value means an object.
Then I met this:
type Value<T> = {
[K in keyof T]: T[K];
};
function a<T>(a: Value<T>): void {
console.log(a);
}
a({ name: "ff" }); //ok
a(1); //ok
So, what does Value<T> mean? Seems quite like a simple <T>, but I don't understand the particular situation to use it.