-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-type-alias] Support enforcing the inverse #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
i'm unsure how enforcing of type aliases should work and how to determine need for type alias
|
All the time, except for this case:
Assuming the above can be detected. Or better said, I want to use type aliases as long as the compiler permits it. |
After spending 5 months working with flow, I've gotten used to writing type statements for everything. The usages part might be hard though because we'd have to track the scope. Doable, but ugly. Depending on complexity it might just be worth having people use disable comments for the rare cases they use interfaces. |
I found this issue while searching for exactly the same thing, although I have a different suggestion. The On the other hand, the I think that the It wouldn't have any breaking change because the default behaviour would still be the same as we have now, but there would be an option to force the inverse and prefer type aliases over interfaces. This is something that other rules already have and wouldn't require a lot of different variations to consider like we would have if updating the |
+1 |
@otofu-square - how come you didn't fork this repo and make you changes in your fork? There isn't a technical limitation for us not yet making the change, it's a manpower issue. There are only a small number of core maintainers. |
@bradzacher I'll try to make a PR to this repository. |
This was fixed in #463 |
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 TSLintinterface-over-type-literal
rule was created has since gone away.I would suggest renaming the rule to
type-alias
(without theno-
prefix) and support enforcing both use and non-use of type alias.Relevant:
In short, the only differences are:
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.The text was updated successfully, but these errors were encountered: