Skip to content

@types/bun: deprecate some unused types especially on Bun ns #19145

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Elusive7733
Copy link

What does this PR do?

Mark unused types as deprecated to improve type clarity and documentation:

  • Add deprecation tags to event listener types (BeforeExitListener, etc.)
  • Deprecate FileBlob with direction to use BunFile instead
  • Replace XMLHttpRequestBodyInit with expanded type definition in fetch.d.ts
  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

Copy link
Member

@alii alii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few more types that should be removed, I think the real fix for this is figuring out a more reliable way to detect these unused types.

Additionally could you please remove the symbols from bun.d.ts that you added to deprecated.d.ts, otherwise they are declared twice.

@Elusive7733
Copy link
Author

making changes.

Also we can create a script or that can detect all unused types to deal with this in the future.

@alii
Copy link
Member

alii commented Apr 22, 2025

Yeah, exactly. A script to detect these would be perfect. I'm not immediately sure how it would behave. Would need some investigation.

@Elusive7733
Copy link
Author

Elusive7733 commented Apr 22, 2025

Hi @alii I have addressed the comments and I am also am working on a script that auto detects unused types.

I think the PR for the script should be a different one, also there are a few edgcases with the script that needs to be considered.

For now / going forward we should probably add an eslint rule for unused types.

@Elusive7733 Elusive7733 force-pushed the chore/deprecate-old-types branch from 1ebc358 to e20566f Compare April 22, 2025 18:47
@alii
Copy link
Member

alii commented Apr 22, 2025

Cool, thanks! I agree, a lint rule would be nice.

Currently busy with some work on the Bun website right now, but I will pull this branch and make sure everything works as expected later today.

@Elusive7733
Copy link
Author

@alii Are you planning to merge this ?

Also can you point out more good first issues that I can pick up.
Looking forward to contribute to bun.

@alii
Copy link
Member

alii commented Apr 24, 2025

@Elusive7733 Looking through at the moment, couple of things I'll update myself on this (your) branch. We will/can probably merge this soon. Thanks again for the contributions.

@alii alii changed the title chore(types): deprecate orphaned types in Bun namespace @types/bun: deprecate some unused types especially on Bun ns Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types An issue with TypeScript types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants