-
Notifications
You must be signed in to change notification settings - Fork 199
feat: simplify types used to register shapes #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, there were TSC errors when registering some builtin or custom shape because their constructor didn't match the signature of the `Shape` constructor. The type of various `CellRenderer` properties and methods has been updated to fix this, so it is no longer necessary to add some 'ts-ignore' to silently ignore these false errors. In addition: - Various improvements in the JSDoc of `CellRenderer` - `CellRenderer.getShape` allows `undefined` parameter - Move `ActorShape` to the directory storing vertex shapes for consistency
WalkthroughThis update refactors type annotations and import paths related to shape constructors within the codebase. A new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CellRenderer
participant ShapeConstructor
User->>CellRenderer: registerShape(name, shape: ShapeConstructor)
CellRenderer->>CellRenderer: Store shape in defaultShapes
User->>CellRenderer: getShapeConstructor(cellState)
CellRenderer->>CellRenderer: Lookup shape in defaultShapes
alt Shape found
CellRenderer->>User: Return ShapeConstructor
else Not found
CellRenderer->>User: Return defaultEdgeShape or defaultVertexShape
end
Possibly related PRs
Suggested labels
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (11)
💤 Files with no reviewable changes (3)
🧰 Additional context used🧬 Code Graph Analysis (2)packages/core/src/view/cell/register-shapes.ts (1)
packages/core/src/view/cell/CellRenderer.ts (1)
🔇 Additional comments (17)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|



Previously, there were TSC errors when registering some builtin or custom shape because their constructor didn't match
the signature of the
Shapeconstructor.The type of various
CellRendererproperties and methods has been updated to fix this, so it is no longer necessary toadd some 'ts-ignore' to silently ignore these false errors.
In addition:
CellRendererCellRenderer.getShapeallowsundefinedparameterActorShapeto the directory storing vertex shapes for consistencySummary by CodeRabbit
New Features
Refactor
Style