Skip to content

@remotion/cloudrun: Add type safety to stream variables#6964

Merged
JonnyBurger merged 2 commits intoremotion-dev:mainfrom
bhaktofmahakal:bhaktofmahakal/add-typesafety
Apr 3, 2026
Merged

@remotion/cloudrun: Add type safety to stream variables#6964
JonnyBurger merged 2 commits intoremotion-dev:mainfrom
bhaktofmahakal:bhaktofmahakal/add-typesafety

Conversation

@bhaktofmahakal
Copy link
Copy Markdown
Contributor

Summary

Replaced any type with proper Readable type for stream variables in Cloud Run rendering functions, addressing the TODO comment requesting type safety.

Changes

  • Added Readable import from 'stream' in both files
  • Changed const stream: any to const stream: Readable with proper type assertion
  • Removed the // TODO: Add any sort of type safety comment

Files Modified

  • packages/cloudrun/src/api/render-media-on-cloudrun.ts
  • packages/cloudrun/src/api/render-still-on-cloudrun.ts

Testing

  • Build successful: bunx turbo run make --filter="@remotion/cloudrun"
  • All tests pass: bun test src (8 tests)
  • Linting passes with no new errors
  • Formatting verified with oxfmt

This change improves type safety and code maintainability without affecting runtime behavior.

Agent-Logs-Url: https://github.com/bhaktofmahakal/remotion/sessions/a3e87ebd-993e-4d9b-b923-283b0e830c4c

Co-authored-by: bhaktofmahakal <113044681+bhaktofmahakal@users.noreply.github.com>
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 2, 2026

Reviewed PR #6964. Suggested parameterizing client.request<Readable>() instead of using as Readable assertions — this achieves the same type safety without an explicit cast. Review

Task list (4/4 completed)
  • Checkout PR and read the diff
  • Read modified files and surrounding context
  • Verify type correctness of Readable usage
  • Submit review or report progress

Pullfrog  | View workflow run | Triggered by Pullfrog | Using Big Pickle (free) | 𝕏

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Apr 3, 2026 7:17am
remotion Ready Ready Preview, Comment Apr 3, 2026 7:17am

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

The direction is right — Readable is the correct runtime type when responseType: 'stream' is used. One suggestion to avoid the as assertion entirely.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Big Pickle (free) | 𝕏

Changed from using `as Readable` type assertions to parameterizing the
client.request<Readable>() call. This achieves the same type safety
without explicit casting, as the generic type parameter properly types
the response.data property.

Addresses review feedback from PR remotion-dev#6964.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: bhaktofmahakal <113044681+bhaktofmahakal@users.noreply.github.com>
Claude AI added a commit to bhaktofmahakal/remotion that referenced this pull request Apr 3, 2026
Changed from using `as Readable` type assertions to parameterizing the
client.request<Readable>() call. This achieves the same type safety
without explicit casting, as the generic type parameter properly types
the response.data property.

Addresses review feedback from PR remotion-dev#6964.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Co-authored-by: bhaktofmahakal <113044681+bhaktofmahakal@users.noreply.github.com>
@bhaktofmahakal
Copy link
Copy Markdown
Contributor Author

The direction is right — Readable is the correct runtime type when responseType: 'stream' is used. One suggestion to avoid the as assertion entirely.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using Big Pickle (free) | 𝕏

Review again

@JonnyBurger JonnyBurger merged commit c4b58d0 into remotion-dev:main Apr 3, 2026
19 checks passed
@JonnyBurger
Copy link
Copy Markdown
Member

Thank you!

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.

3 participants