Skip to content

refactor(deploy): improve types to avoid extraneous runtime check #7220

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

serhalp
Copy link
Collaborator

@serhalp serhalp commented Apr 17, 2025

Summary

By improving these types and avoiding some reassignments we can let TS understand it better and avoid an extraneous runtime check.

Reviewer: this isn't easy to explain, because this code is quite messy. I suggest carefully reading through the logic in the main version before trying to grok my diff.

Follow-up to https://github.com/netlify/cli/pull/7194/files#r2039642849

This code is messy, but by improving the typess and avoiding some reassignments we can let
TS understand it better and avoid an extraneous runtime check.
Copy link

📊 Benchmark results

Comparing with 546f156

  • Dependency count: 1,156 (no change)
  • Package size: 281 MB ⬇️ 0.00% decrease vs. 546f156
  • Number of ts-expect-error directives: 465 (no change)

@serhalp serhalp marked this pull request as ready for review April 17, 2025 13:47
@serhalp serhalp requested a review from a team as a code owner April 17, 2025 13:47
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant