Skip to content

Tighten TS defs and add Arc module types - #840

Merged
jonobr1 merged 3 commits into
devfrom
type-errors
Aug 24, 2026
Merged

Tighten TS defs and add Arc module types#840
jonobr1 merged 3 commits into
devfrom
type-errors

Conversation

@jonobr1

@jonobr1 jonobr1 commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Adds a new declaration file for two.js/extras/jsm/arc and broad TypeScript definition improvements across shapes, effects, renderers, registry, and core APIs. This aligns typings with runtime behavior (e.g., optional clone parents, release overloads, makeTexture input types, renderer constructor params, and ZUI overloads), and updates the TypeScript test file to cover the new and corrected type contracts.

Adds a new declaration file for `two.js/extras/jsm/arc` and broad TypeScript definition improvements across shapes, effects, renderers, registry, and core APIs. This aligns typings with runtime behavior (e.g., optional `clone` parents, `release` overloads, `makeTexture` input types, renderer constructor params, and ZUI overloads), and updates the TypeScript test file to cover the new and corrected type contracts.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are verified type/runtime mismatches in the new/modified declarations (notably Arc.clone contract vs runtime) and a couple of typing inaccuracies that should be corrected before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR expands and tightens Two.js TypeScript declarations to better reflect runtime behavior, including adding a new declaration for the two.js/extras/jsm/arc module and extending the TypeScript compilation test to exercise the updated contracts.

Changes:

  • Added two.js/extras/jsm/arc TypeScript declarations and updated the TS test to import/use Arc.
  • Tightened core typings (e.g., Two#release overloads, Two#makeTexture input types) and improved type coverage for cloning APIs across shapes/effects.
  • Refined extra / renderer typings (e.g., ZUI overloads, renderer constructor parameter objects) and added Registry#contains.
File summaries
File Description
tests/typescript/index.ts Extends TS compilation coverage for new/updated type contracts (Arc, ZUI, renderers, release/makeTexture, clones).
src/two.d.ts Refines release overloads and narrows makeTexture input types.
src/text.d.ts Adds a Text#clone(parent?) signature to match runtime.
src/shapes/star.d.ts Makes clone(parent) optional.
src/shapes/rounded-rectangle.d.ts Adds clone(parent?) signature and imports Group for typing.
src/shapes/rectangle.d.ts Makes clone(parent) optional.
src/shapes/polygon.d.ts Adds radius and makes clone(parent) optional.
src/shapes/points.d.ts Makes clone(parent) optional.
src/shapes/ellipse.d.ts Adds clone(parent?) signature and imports Group for typing.
src/shapes/circle.d.ts Makes clone(parent) optional.
src/shapes/arc-segment.d.ts Makes clone(parent) optional.
src/renderers/webgl.d.ts Requires a parameter object and tightens the constructor param shape.
src/renderers/svg.d.ts Requires a parameter object and tightens the constructor param shape.
src/renderers/canvas.d.ts Requires a parameter object and tightens the constructor param shape.
src/registry.d.ts Adds contains(id): boolean to Registry typings.
src/effects/image.d.ts Adds Image#clone(parent?) signature and imports Group for typing.
src/effects/image-sequence.d.ts Makes clone(parent) optional.
src/effects/gradient.d.ts Fixes Gradient.fromObject stops typing to accept Stop or stop-like objects.
extras/jsm/zui.d.ts Tightens ZUI constructor and adds overloads for coordinate conversion and limits.
extras/jsm/arc.d.ts Introduces new Arc module declarations.
Review details
  • Files reviewed: 1/20 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jonobr1
jonobr1 merged commit ae0fffc into dev Aug 24, 2026
6 checks passed
@jonobr1
jonobr1 deleted the type-errors branch August 24, 2026 17:35
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