Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the texture tool project from JavaScript to TypeScript, adding comprehensive type safety throughout the codebase. The migration also includes build system updates to support TypeScript compilation, ESLint configuration for TypeScript files, and several bug fixes discovered during the type annotation process.
Key changes:
- Complete migration of all source files from
.jsto.tswith type annotations - Addition of TypeScript compiler configuration and build tooling
- ESLint configuration extended to support TypeScript linting
- Several bug fixes identified and corrected during migration (including API usage fixes, typo corrections, and type consistency improvements)
Reviewed changes
Copilot reviewed 27 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | New TypeScript compiler configuration with ES2022 target and strict type checking options |
| src/**/*.ts | All source files migrated to TypeScript with comprehensive type annotations for classes, methods, parameters, and return types |
| src/declaration.d.ts | New type declarations for File System Access API and browser extensions |
| rollup.config.mjs | Updated to use TypeScript plugin and refactored copy-and-watch plugin configuration |
| plugins/copy-and-watch.mjs | Refactored Rollup plugin moved to dedicated plugins directory with improved structure |
| eslint.config.mjs | Extended ESLint configuration to support TypeScript with appropriate parser and plugins |
| package.json | Added TypeScript dependencies and tooling (@typescript-eslint packages, TypeScript 5.9.3) |
| copy-and-watch.mjs | Original plugin file removed (moved to plugins/ directory) |
| src/texture-doc.js | Removed (replaced by src/texture-doc.ts) |
Comments suppressed due to low confidence (11)
src/reproject-panel.ts:207
- The change from accessing 'format[targetEncoding]' instead of assigning 'format' directly is a bug fix. The original code would have assigned the entire format object to the texture format property instead of looking up the specific format value for the target encoding.
src/export-panel.ts:34 - The change from 'data.buffer' to wrapping the data in a Blob fixes a potential issue. The original code passed a Uint8Array directly, but the Blob constructor expects an array of buffer sources. While both might work in some browsers, wrapping the data properly is more correct.
src/reproject-panel.ts:224 - Fixed spacing inconsistency. The default case now has consistent spacing with other cases in the switch statement (removed extra space before 't.type').
src/files-browser-panel.ts:371 - The trailing space after 'ui.selected' has been removed, improving code cleanliness and consistency.
src/texture-view.ts:67 - The property name 'opaqueSortMode' appears to be correct, but the original code had 'opaqueSortMost' which looks like a typo. However, this change is in the middle of a TypeScript migration and appears to be fixing a bug rather than introducing one. The correct property name for the Layer constructor should be 'opaqueSortMode' based on the PlayCanvas engine API.
src/texture-view.ts:140 - The change from 'Uint8ClampedArray' to 'Uint8Array' changes the behavior of array element clamping. Uint8ClampedArray automatically clamps values to the 0-255 range, while Uint8Array wraps values using modulo arithmetic. For creating a default texture with fixed values [64, 64, 64, 255], this change is safe, but it's worth noting this behavioral difference.
src/reproject-panel.ts:200 - The variable name 'typeMap' is more descriptive and accurate than 'type' since it's a mapping object rather than a single type value. This is an improvement in code clarity and naming convention.
src/texture-manager.ts:66 - The AssetRegistry.remove() method expects an Asset object as a parameter, not an ID number. The change from 'this.assets.remove(id)' to 'this.assets.remove(asset)' is a bug fix that corrects the API usage.
src/render-canvas.ts:49 - Fixed typo in CSS style property. The original code had 'py' instead of 'px' for the height unit, which would cause incorrect styling. This is a bug fix rather than an introduction of a new bug.
src/reproject-panel.ts:154 - The value should be a string '2' instead of a number 2, based on the type inference from the encoding variable which uses string values elsewhere. This change appears to be a bug fix ensuring type consistency.
src/reproject-panel.ts:285 - The removed function 'generateEnvAtlas' was never implemented (it had an empty body) and was not being called anywhere in the codebase. This is a cleanup of dead code during the TypeScript migration.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
slimbuck
approved these changes
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request migrates the codebase from JavaScript to TypeScript, enhances type safety, and improves the build and linting setup. It removes the old
copy-and-watch.mjsplugin, introduces a new TypeScript-compatible version underplugins/, updates the Rollup and ESLint configurations for TypeScript support, and refactors source files to use explicit types and interfaces. Several dependencies are updated or added to support these changes.Build and Tooling Improvements:
copy-and-watch.mjswith a new, TypeScript-compatible version inplugins/copy-and-watch.mjs, and updates the usage inrollup.config.mjsto use the new plugin and a sharedTARGETSarray. [1] [2] [3] [4] [5]@rollup/plugin-typescriptand updates the Rollup config to usesrc/index.tsas the entry point, enabling TypeScript compilation. [1] [2] [3] [4]Source Code Refactoring to TypeScript:
.jsto.tsand adds type annotations, interfaces, and type imports throughout the codebase for improved type safety (e.g.,src/const.ts,src/drop-handler.ts,src/export-panel.ts,src/feedback-panel.ts,src/file-tabs.ts). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Dependency Updates:
typescript,tslib,@typescript-eslint/*,eslint-import-resolver-typescript, etc.) and bumpsrollupto the latest version.These changes collectively modernize the codebase, streamline the build process, and improve maintainability and type safety.