types(dia): infer view type from the model in view lookups - #3473
Draft
kumilingus wants to merge 1 commit into
Draft
types(dia): infer view type from the model in view lookups#3473kumilingus wants to merge 1 commit into
kumilingus wants to merge 1 commit into
Conversation
cell.findView() is covariantly overridden on Element/Link, and paper.findViewByModel()/getCellView() gain per-model overloads - the caller-asserted generics remain as deprecated tails for compatibility. Return types now admit the absent-view case (undefined for findView/ findViewByModel, matching the runtime; getCellView already returned null). Adjust @joint/react call sites accordingly - one @ts-expect-error became unnecessary since link.findView() now types as LinkView. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
kumilingus
marked this pull request as draft
August 21, 2026 09:42
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.
Typings-only change to the three model-based view lookups (runtime untouched):
cell.findView(paper)- covariant overrides:ElementreturnsElementView | undefined,LinkreturnsLinkView | undefined.paper.findViewByModel()/paper.getCellView()- per-model overloads (Element→ElementView,Link→LinkView,Cell/id →CellView); the caller-asserted generic signatures remain as@deprecatedtails so existingfindViewByModel<ElementView>(…)call sites keep compiling.| undefinedforfindView/findViewByModel(matching the runtime),getCellViewkeeps its genuine| null.@joint/reactcall sites adjusted (guards at three sites; one@ts-expect-errordeleted becauselink.findView()now types asLinkView, whererequestConnectionUpdateexists).paper.findView($el)(DOM-node lookup) intentionally untouched - different use case, nothing to infer from.Changeset:
@joint/corepatch.🤖 Generated with Claude Code