Description
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:
- 2019 situation about the differences: https://stackoverflow.com/a/52682220/64949
- TSLint thread about it: interface-over-type-literal shouldn't be recommended palantir/tslint#3248
In short, the only differences are:
- A class cannot implement / extend a type alias that names a union type.
- 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.