Skip to content

Remove unused optional props and arguments - #7997

Closed
JonasBa wants to merge 1 commit into
signalapp:mainfrom
JonasBa:jonas/unused-props-cleanup
Closed

Remove unused optional props and arguments#7997
JonasBa wants to merge 1 commit into
signalapp:mainfrom
JonasBa:jonas/unused-props-cleanup

Conversation

@JonasBa

@JonasBa JonasBa commented Aug 21, 2026

Copy link
Copy Markdown

Hey folks, I'm working on an experimental CLI which uses the tsgo toolchain to find optional component and function signatures that are in practice never passed. This is essentially dead code elimination, and a complementary workflow to run alongside a tool like knip.

The changeset in this PR has been done using the script as the reporting tool, and an agent validator loop walking through each reported line one by one to first inspect the report, analyze the call sites, removing them, and later re-running ts. If done correctly, the code that has been removed should have been effectively dead.

The reporting script heavily relies on type quality and only reports on types whos members are statically enumerable.

Deliberately left out of this PR:

  • everything under ts/sql/ (the DataReader/DataWriter IPC dispatch hides call sites from static analysis)
  • test/CI/mock-server helpers
  • arguments on callbacks that escape as values (e.g. handlers passed into props), where a removal is type-safe even when wrong
  • the onProgress/maxRetries plumbing in tusProtocol since it forms a coherent capability

I'm opening this PR in an effort to help you eliminate dead code, but also to gain feedback on the script and the detection mechanisms. There are always risks of false positive reports, and removal of code that is actually still required at runtime.

Some references of PRs opened to other repositories that have been merged or are still open:
Sentry (4k loc removed)
Sentry (followup 1k loc removed)
Tanstack
npmx

Would love to hear your feedback 🙏🏼

Made with Cursor

Generated with an experimental CLI that inspects every call site of a
function or component and flags optional props and arguments that are
never provided. Each finding was manually verified against call sites;
previous defaults are inlined so runtime behavior is unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ayumi-signal

Copy link
Copy Markdown
Contributor

Hi, thanks for your interest. This is potentially a good idea, but we're not open to taking this type of PR currently.

@JonasBa

JonasBa commented Aug 21, 2026

Copy link
Copy Markdown
Author

@ayumi-signal appreciate the fast review. Let me know if this is something you'd be interested in at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants