Skip to content

Suggestion: Allow classes to implement type aliases #11207

@Elephant-Vessel

Description

@Elephant-Vessel

The implements-keyword in TS is used to guide the programmer of a class to ensure that the class is compatible with a certain (structural) type.

The interface-keyword in TS defines a type, that except being a regular type, can be used design-time as a tool to ensure that a class is compatible with a (structural) type.

Types other than those defined by interface or class can not be used with the implements-keyword.

I suggest to drop this constraint to allow authors of classes to use (almost*) any type to guide the implementation of a class.

* Except types consisting of primitives (string, bool, number...), as these are nominal and cannot be implemented by a class.

(Sorry if this already have been discussed somewhere, but I can't find anything.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issueSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions