Skip to content

feat: type writer property as GLTFWriter in VariantMaterialExporterPlugin#5175

Merged
diegoteran merged 1 commit into
google:masterfrom
charanrajkandula-opensource:feat/exporter-gltfwriter-type
Jun 18, 2026
Merged

feat: type writer property as GLTFWriter in VariantMaterialExporterPlugin#5175
diegoteran merged 1 commit into
google:masterfrom
charanrajkandula-opensource:feat/exporter-gltfwriter-type

Conversation

@rajkandula

Copy link
Copy Markdown
Contributor

Description

This PR replaces the any type on the writer property in VariantMaterialExporterPlugin.ts with the concrete GLTFWriter imported from three/examples/jsm/exporters/GLTFExporter.js.

Since @types/three is missing declarations for processMaterialAsync and json on GLTFWriter, this PR utilizes TypeScript module augmentation to safely extend the type. It also adds a type predicate (material is Material) to compatibleMaterial to safely narrow material types within loops and ternary expressions.

This resolves the pending @TODO comment in the exporter plugin file.

Reference Issue

None (resolves a pending inline TODO comment).

Testing

  • Verified successful workspace builds using npm run build.
  • Ran the test suite via npm run test:ci with all tests passing:
    • @google/model-viewer: 393 passed, 0 failed
    • @google/model-viewer-effects: 13 passed, 0 failed
    • @google/model-viewer-space-opera: 99 passed, 0 failed

@diegoteran diegoteran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks

@diegoteran diegoteran merged commit fae2a75 into google:master Jun 18, 2026
7 checks passed
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