Skip to content
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

🚀 Feature: typeParts API, combining intersectionTypeParts and unionTypeParts? #258

Closed
3 tasks done
JoshuaKGoldberg opened this issue Aug 15, 2023 · 1 comment · Fixed by #374
Closed
3 tasks done
Assignees
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request 🚀

Comments

@JoshuaKGoldberg
Copy link
Owner

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

https://github.com/typescript-eslint/typescript-eslint/pull/7466/files#diff-3cc43b506517aba406ae3a31d7998b116c4b09db76b632c6cb3c2e54fc71d66cR33 shows code that wants the type parts of a type that can be either an intersection or union. Maybe it'd be nice to expose a simplified function to do this? Maybe with a recursive?: boolean parameter/option?

My instinct is no, since folks can do this pretty on their own in a straightforward manner. But just thinking out loud.

Additional Info

No response

@JoshuaKGoldberg
Copy link
Owner Author

I came across a second place in typescript-eslint that would benefit from a basic version of this function. Seems like a good enough reason for me.

RebeccaStevens pushed a commit that referenced this issue Feb 4, 2024
## PR Checklist

- [x] Addresses an existing open issue: fixes #258
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/ts-api-utils/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Adds in a shallow `typeParts` function. It's roughly equivalent to the
existing `intersectionTypeParts` and `unionTypeParts` functions.

Doesn't add in a `{ recursive?: boolean }` or anything like that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request 🚀
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant