-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Consider not wrapping types #152
Comments
I think a good starting point for you would be to look what you can do in https://github.com/Shinigami92/eslint-define-config/blob/main/scripts/generate-rule-files/src/rule-file.ts |
I'm not sure it's very relevant. It might be if the rule only offers one option. But what about other rules that can accept up to 3 parameters? Let's take this one for example: I believe the resulting type would be much more complicated to understand than the one we have now. However, yes, we can apply this system to rules that only offer one option. I'm not yet convinced of the relevance of adding this, but if you think it is, I think we can reconsider this PR #142 This would be a perfect use case. Just add a new module like "RewriteSimpleTypes", this new module would accept the AST as a parameter, and check if the rule contains just one option. And if it does, it would rewrite the AST to propose a simpler type. And the RulePatcher would then rewrite the file. This is the whole principle of the RulePatcher :
|
Just add another wrapper type: type Simplify<T extends object> = {
[K in keyof T]: T[K]
} & {} |
If instead of
the typings would use
the intellisence would hint the type as
which may be more understandable for simple types
The same thing also could be done on the type level of
defineConfig
itselfThe text was updated successfully, but these errors were encountered: