Skip to content

TS migration - #506

Open
dubeyShivank wants to merge 103 commits into
mainfrom
feature/typescript
Open

TS migration#506
dubeyShivank wants to merge 103 commits into
mainfrom
feature/typescript

Conversation

@dubeyShivank

@dubeyShivank dubeyShivank commented Nov 13, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR completes the full migration of the Millicast SDK from JavaScript to TypeScript, providing type safety, improved developer experience, and better IDE support for SDK consumers.

Key Changes

🔄 TypeScript Migration

  • All SDK source files converted from .js to .ts
  • Full type annotations for all classes, methods, and properties
  • Strict TypeScript compilation with no errors
  • Removed legacy JavaScript files from packages/millicast-sdk/src/

📦 Typed Event System

  • Created MillicastEventEmitter - a generic typed event emitter class
  • Added comprehensive event type interfaces:
  • ViewerEvents - events for View (subscriber) class
  • PublisherEvents - events for Publish class
  • PeerConnectionEvents - WebRTC connection events
  • PeerConnectionStatsEvents - statistics events
  • SignalingEvents - WebSocket signaling events
  • SDK consumers can now get full TypeScript intellisense for event handlers

📤 Standardized Exports

  • Reorganized index.ts with clear sections:
  • Core Modules: Director, Logger, PeerConnection, Signaling, Publish, View
  • Named Exports: defaultApiEndpoint, signalingEvents, ConnectionType, webRTCEvents, VideoCodec, AudioCodec
  • Type Exports: All TypeScript interfaces and types for SDK consumers
  • 100% backwards compatible - all existing exports preserved

🧹 Code Quality Improvements

  • Replaced all console.* calls with structured Logger abstraction
  • Migrated ESLint to flat config (eslint.config.mjs) - removes deprecation warnings
  • Fixed lint-staged configuration for pre-commit hooks
  • Added new unit tests for FetchError, Signaling, and View classes

🏗️ Build & Tooling

  • Updated Vite configuration for TypeScript builds
  • Proper .d.ts type declaration file generation
  • All demo projects updated to work with TypeScript SDK

Breaking Changes

None - This migration maintains full backwards compatibility with existing JavaScript/TypeScript consumers.

Testing
✅ 345 unit tests passing (3 skipped)
✅ All E2E tests passing
✅ TypeScript compilation clean
✅ ESLint passing
✅ Build succeeds for all 6 projects


Open with Devin

@changeset-bot

changeset-bot Bot commented Nov 13, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0de4066

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread packages/millicast-sdk/src/utils/SdpParser.ts Fixed
Comment thread packages/millicast-sdk/src/utils/SdpParser.ts Fixed
Comment thread packages/millicast-multiview-demo/src/multiviewer.ts Fixed
Comment thread packages/millicast-multiview-demo/src/multiviewer.ts Fixed
@dubeyShivank
dubeyShivank force-pushed the feature/typescript branch 3 times, most recently from a1649d1 to 7984f89 Compare November 17, 2025 07:09
FabienLavocat and others added 2 commits March 16, 2026 15:33
Signed-off-by: Fabien Lavocat <4154532+FabienLavocat@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

dubeyShivank and others added 3 commits March 24, 2026 16:25
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread packages/millicast-sdk/tests/e2e/utils/static-server.js Dismissed
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 23 additional findings in Devin Review.

Open in Devin Review

Comment on lines +552 to +555
opts.headers = (opts.headers as Headers) || new Headers();
if (!opts.headers) {
opts.headers = new Headers();
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 View.onRtcDrmFetch has dead null check due to preceding fallback assignment

At View.ts:552, opts.headers is always assigned a non-null value via the || fallback: opts.headers = (opts.headers as Headers) || new Headers(). The very next line if (!opts.headers) at line 553 is therefore always false, making the opts.headers = new Headers() on line 554 dead code. While this doesn't cause a crash, it indicates the null-safety intent was incorrectly implemented. The original JS code (View.js:473-475) also had this pattern, but the TypeScript rewrite should have cleaned it up.

Suggested change
opts.headers = (opts.headers as Headers) || new Headers();
if (!opts.headers) {
opts.headers = new Headers();
}
async onRtcDrmFetch (url: string, opts: RequestInit) {
if (!opts.headers || !(opts.headers instanceof Headers)) {
opts.headers = new Headers();
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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