Skip to content

type transformation for mapping object properties to function parameters #12265

Closed
@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd

now that we have map types it would nice being able to map properties to function parameters

type Constructor<T> = (P in T) => T;
interface Data {
    name: string;
    value: number;
}
type CreateData = Constructor<Data>;

would desugar to

type CreateData = (name: string, value: number) => Data;

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions