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
no-type-alias could be helpful #56
Comments
After reading the docs for that, as well as the other rules in this repo, I would configure {
// Enables things that are difficult to achieve in other ways:
allowAliases: 'in-unions-and-intersections',
allowLiterals: 'in-unions-and-intersections',
allowMappedTypes: 'in-unions-and-intersections',
// The `prefer-function-type` rule forces this:
allowCallbacks: 'always'
} |
@swansontec, I read the rule doc and I agree with the options suggested by you. |
I use case I've ran into lately is: import firebase = require('firebase')
type DocumentReference = firebase.firestore.DocumentReference
// ...
function foo(ref: DocumentReference) {
// ...
} |
@LinusU That's a valid point! Shortening long names might also be a valid use-case. The The main benefit I can see would be banning "useless" type aliases like |
Shortening a nested type does seem like a constructive pattern. Isn't there another way to get a reference to that nested type other than with a type alias? And... did you check that this is an error according to this rule? It seems like it would be, always. I'm closing this on the count of @LinusU's shortening example. If anyone has an idea, please reopen. |
I would love to know this as well! |
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-type-alias.md
The text was updated successfully, but these errors were encountered: