Repository navigation
docs: describe calling @ClientCallable methods from TypeScript - #6674
Merged
Merged
Conversation
A TypeScript class doesn't declare the $server property that Flow adds to the root element, so calls to @ClientCallable methods don't compile without a cast to any. Show how to type $server with an interface and a declare field, and how to type an element passed from outside the class. Fixes #989 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vaadin-review-bot
left a comment
There was a problem hiding this comment.
✅ Nothing to flag — the changes look good.
Contributor
Preview DeploymentThis PR has been deployed for preview. URL: https://docs-preview-pr-6674.fly.dev Changed pagesAdded content is highlighted in green; removed content is marked in red on each page.
Built from 27cdd1e |
peholmst
added a commit
that referenced
this pull request
Nov 13, 2026
… (CP: v25.3) (#6675) Co-authored-by: Petter Holmström <petter@vaadin.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #989
What changed
Adds a "Calling Server-Side Methods from TypeScript" section to the Remote Procedure Calls reference page (
articles/flow/component-internals/client-server-rpc.adoc).A TypeScript class doesn't declare the
$serverproperty that Flow adds to the root element, sothis.$server.method()doesn't compile, and users fall back to(this as any).$server. The new section shows how to:@ClientCallablemethods in an interface whose methods return aPromise$serverwith that type usingdeclare $server: GreetingServer;in a Lit elementHTMLElement & { $server: GreetingServer }Notes for reviewers
declarerather than a plain field (or theprivate $server: any;suggested in the issue): Vaadin's generatedtsconfig.jsonenablesstrict, so a typed field withoutdeclarefails with TS2564. This is also the pattern Flow Components uses, for exampledeclare $server: GridServerinvaadin-grid-flow-selection-column.ts.@ClientCallablemethod on$serverreturns a Promise (bindServerEventHandlerNamesdefaultsreturnValuetotrue).tsconfig.json: it compiles. Withoutdeclareit fails with TS2564, and with no declaration with TS2339..vale-pr.ini) reports nothing on the added lines. The site build wasn't run locally.target/v25.3: the page is identical onv25.3and the behavior exists there.🤖 Generated with Claude Code