Skip to content

client/modules/Preview: migrate to TypeScript, no-verify#4049

Open
NalinDalal wants to merge 5 commits intoprocessing:developfrom
NalinDalal:develop
Open

client/modules/Preview: migrate to TypeScript, no-verify#4049
NalinDalal wants to merge 5 commits intoprocessing:developfrom
NalinDalal:develop

Conversation

@NalinDalal
Copy link
Copy Markdown

@NalinDalal NalinDalal commented Mar 28, 2026

Fixes #3828

Summary

Migrated client/modules/Preview from JavaScript to TypeScript to improve type safety and developer experience.

Changes

Files Converted:

File Description
EmbedFrame.tsx Main preview iframe component with styled-components
filesReducer.ts Redux reducer for managing preview files
previewIndex.tsx Preview entry point

Type Definitions Added

PreviewFile interface (filesReducer.ts:6-16):

interface PreviewFile {
  id: string;
  name: string;
  content: string;
  url?: string;
  blobUrl?: string;
  children: string[];
  filePath?: string;
  fileType?: string;
  _id?: string;
  isSelectedFile?: boolean;
}

EmbedFrameProps interface (EmbedFrame.tsx:21-27):

interface EmbedFrameProps {
  files: PreviewFile[];
  isPlaying: boolean;
  basePath: string;
  gridOutput: boolean;
  textOutput: boolean;
}

Module Declarations

Added type declarations for third-party libraries (custom.d.ts):

  • loop-protect - Loop protection library
  • mime - MIME type detection library

Other Changes

  • Removed PropTypes runtime validation (replaced with compile-time TypeScript types)
  • Added strict typing for all function parameters and return values
  • Updated webpack config to resolve .tsx extensions

Breaking Changes

None - all changes are backward compatible.

@release-com
Copy link
Copy Markdown

release-com bot commented Mar 28, 2026

Release Environments

This Environment is provided by Release, learn more!
To see the status of the Environment click on Environment Status below.

🔧Environment Status : https://app.release.com/public/Processing%20Foundation/env-6e3c605b9c

@yugalkaushik
Copy link
Copy Markdown
Contributor

While working on the migration to TypeScript, please ensure that all changes are clearly and thoroughly documented in the PR description. This should include details about what was converted, any type definitions added or modified, breaking changes (if any), and the overall approach taken. Clear documentation helps reviewers understand the scope and intent of the changes more effectively.

@NalinDalal
Copy link
Copy Markdown
Author

Updated with correct types and description on pr body

@NalinDalal NalinDalal requested a review from yugalkaushik March 31, 2026 05:25
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.

TypeScript migration: client/modules/Preview

2 participants