Skip to content

Conversation

Copy link

Copilot AI commented Nov 21, 2025

The LOD branch had 16 TypeScript compilation errors preventing builds, primarily from type incompatibilities with THREE.js, missing type definitions, and unsafe DOM event handling.

Type Compatibility Fixes

Uint8Array buffer types: THREE.js DataTexture/Data3DTexture constructors expect ArrayBuffer, but zarr returns ArrayBufferLike. Created new instances to ensure type compatibility:

// Before: Type error - ArrayBufferLike not assignable to ArrayBuffer
texture = new THREE.Data3DTexture(dataSlice, shape[1], shape[2], shape[3]);

// After: Create new instance with proper buffer type
const data = new Uint8Array(dataSlice);
texture = new THREE.Data3DTexture(data, shape[1], shape[2], shape[3]);

PersistenceMode type: Defined locally as 'r' | 'r+' | 'a' | 'w' | 'w-' instead of importing from non-exported zarr internal types.

Event Handling Type Safety

Added helper functions to avoid inline type assertions in Svelte templates:

function getCheckboxValue(event: Event): boolean {
  return (event.target as HTMLInputElement).checked;
}

// Usage in template
on:change={(e) => ($settings.enabled = getCheckboxValue(e))}

Modal dialogs: Replaced 'showModal' in modal checks with modal instanceof HTMLDialogElement for proper type narrowing.

Shader Import Updates

Updated example files to import volumeTransfer.frag instead of removed volume.frag.

Function Signature Fixes

Made getVoxelAndVolumeSize parameters optional with defaults to match call sites that only provide { store, shape }.

Original prompt

proceed

Created from VS Code via the GitHub Pull Request extension.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update feature implementation for better performance Fix TypeScript compilation errors in LOD branch Nov 21, 2025
Copilot AI requested a review from goord November 21, 2025 21:30
Copilot finished work on behalf of goord November 21, 2025 21:30
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.

2 participants