Closed
Description
According to #12114 mapped types currently support following forms:
{ [ P in K ] : T }
{ [ P in K ] ? : T }
{ readonly [ P in K ] : T }
{ readonly [ P in K ] ? : T }
I think it shall also at least support a function form:
{ ([ P in K ]) : T }
{ ([ P in K ]) ? : T }
{ ([ P in K])(entities: P[], someBoolean: boolean) ? : T }
Currently Im trying to implement a Functionize<T>
interface which forces implementors to implement any property of the T, but make it a function with maybe additional arguments. Example:
interface User {
name: string;
age: number
}
I want to do Functionize which I want to give me:
{
name(names: string[]): string;
age(ages: number[]): number;
}
And I'm asking about following method signature:
type Functionize<T> = {
[P in keyof T](values: T[])?: T[P];
};