-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore(utils): use Extract
generic for ast-utils
' predicates
' helper functions
#4545
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
Conversation
Thanks for the PR, @MichaelDeBoey! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
f9ad3e2
to
a94e466
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extract
is indeed neat, but this is a few extra characters per line for... what is the benefit here?
Happy to approve if there's some reason for it that can be shown. 🙂
a94e466
to
73f74b2
Compare
@JoshuaKGoldberg As seen in the mentioned tweets, this wil result in a nicer type & cleaner error messages type A = { name: 'A', lowercase: 'a' };
type B = { name: 'B', lowercase: 'b' };
type AOrB = A | B;
type AWithExact = Exact<AOrB, { name: 'A' }>;
// type A
type AWithoutExact = AOrB & { name: 'A' };
// { name: 'A', lowercase: 'a' } & { name: 'A' } | { name: 'B', lowercase: 'b' } & { name: 'A' }
// which results in { name: 'A', lowercase: 'a' } & { name: 'A' } | never
// or just { name: 'A', lowercase: 'a' } & { name: 'A' }
// which is the same as { name: 'A', lowercase: 'a' }
// which is the same as type A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks - that makes sense!
Maybe we should include a lint rule asking for this preference?
@JoshuaKGoldberg I think this can indeed be a great addition to this package 👍 |
It seems like type checks are failing, but I can't figure out why exactly tbh. @farskid @Beraliv Do one of you guys have any pointers for me please? CC/ @bradzacher |
73f74b2
to
3a4e29e
Compare
3a4e29e
to
1879833
Compare
that is a truly gnarly error message lol |
1879833
to
9d81ce3
Compare
From the error...
is TS doing something weird here? why are there duplicate named types it's referencing? |
9d81ce3
to
d33209a
Compare
@bradzacher I've reverted all the changes except for |
Just one error now which is nowhere near as gnarly!
|
@bradzacher Do you happen to know how I could fix it? |
From what I can tell - the issue is that Make the following two changes:
A TODO here would be for us to add a test to ensure that all types named within our |
@bradzacher Those changes seem to be fixing the issues indeed I'll update all other helper functions again, so we can see if that was the only problem or not.
I have the feeling that with the changes in this PR in place, CI will automatically fail again whenever we don't export everything correctly. |
a9ea0b6
to
928a2d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - just one comment
packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts
Outdated
Show resolved
Hide resolved
9f820a9
to
8def652
Compare
Thanks to @farskid & @Beraliv for the TILs! 💪
https://twitter.com/farzad_yz/status/1492127144423694338
https://twitter.com/beraliv/status/1425767234878812165