Fix TypeScript definitions for missing force graph methods#715
Open
micahstubbs wants to merge 3 commits into
Open
Fix TypeScript definitions for missing force graph methods#715micahstubbs wants to merge 3 commits into
micahstubbs wants to merge 3 commits into
Conversation
Adds explicit method definitions for linkedFGMethods that were missing from the TypeScript interface, resolving compilation errors for graphData, warmupTicks, refresh, and other methods.
Documents the resolution of missing method definitions in TypeScript interface that was causing compilation errors for graphData and other force graph methods.
Owner
|
@micahstubbs thanks for the PR. I'm not sure what's happening here, those method types should be available from the extended class Also you mention that |
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.
Problem Summary
Issue: Property 'graphData' does not exist on type 'ForceGraph3D<NodeObject, any>'
Impact: Critical - Blocks all TypeScript users from upgrading to v1.74.0+
Root Cause: Missing method definitions in TypeScript interface
Technical Analysis
The issue was caused by incomplete TypeScript definitions in
src/index.d.ts. While the interface extendedThreeForceGraphGeneric(which provides methods likegraphData,warmupTicks, etc.), some methods from the JavaScript implementation'slinkedFGMethodswere not properly exposed in the TypeScript definitions.Missing Methods Identified
From
linkedFGMethodsinsrc/3d-force-graph.js:refresh()- Redraws all nodes/linksgetGraphBbox()- Returns graph bounding boxd3Force()- Getter/setter for d3 simulation forcesd3ReheatSimulation()- Reheats the force simulationemitParticle()- Emits particles on demandSolution Implemented
1. Updated TypeScript Interface
Added explicit method definitions to
ForceGraph3DGenericInstanceinterface insrc/index.d.ts:2. Verified Fix
yarn buildcompleted successfullyTesting Performed
TypeScript Compilation Test
✅ Result: Compiles without TypeScript errors
Method Availability Test
graphData()- Core method now properly typedwarmupTicks()- Available through base class extensionrefresh()- Now explicitly definedgetGraphBbox()- Now explicitly definedImpact
Before Fix
After Fix
Deployment Notes
Fix #694