Skip to content

allow type declarations inside objects #8308

Closed
@zpdDG4gta8XKpMCd

Description

@zpdDG4gta8XKpMCd
interface W<X, Y, Z> { x: X; y: Y; z: Z; }

function toModule<X, Y, Z>()  {
     type $W = W<X, Y, Z>;
     return {
        W: $W // <-- wish could do that
     };
}

const m = toModule<string, number, boolean>();
const w : m.W = { // <-- wish could do that
   x: '',
   y: 0,
   z: false
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions