Skip to content

[no-type-alias] Support enforcing the inverse #142

@sindresorhus

Description

@sindresorhus

Similar to my #103 issue.

The no-type-alias rule enforces not using type aliases, but I would like to enforce use of type aliases whenever possible. I actually prefer them, and most of the type alias limitations that existed when the original TSLint interface-over-type-literal rule was created has since gone away.

I would suggest renaming the rule to type-alias (without the no- prefix) and support enforcing both use and non-use of type alias.

Relevant:

In short, the only differences are:

  1. A class cannot implement / extend a type alias that names a union type.
  2. Declaration merging doesn't work with type aliases.

Personally, I would like to use enforce type aliases whenever possible, which means all the time, except for number 1.. I don't use declaration merging.

I also noticed there's a prefer-interface rule which seems to overlap with this one. It should probably be merged into this one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis change will require a new major version to be releasedenhancement: plugin rule optionNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions