Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@sindresorhus

Description

@sindresorhus
Issue body actions

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 releasedThis change will require a new major version to be releasedenhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulehas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.