Skip to content

docs(lit): fix quick-start examples that don't type-check - #2487

Merged
LeCarbonator merged 2 commits into
TanStack:mainfrom
victuribdev:docs-lit-quick-start-generics
Nov 21, 2026
Merged

LeCarbonator merged 2 commits into
TanStack:mainfrom
victuribdev:docs-lit-quick-start-generics

Conversation

@victuribdev

@victuribdev victuribdev commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Changes

Fixes #2486.

The Lit quick-start passed <Employee> to TanStackFormController, which needs 12 type arguments (TS2558), and annotated the field callback with FieldApi<Employee, 'firstName'>, which needs 23 (TS2314). Basic concepts had the same FieldApi annotation.

Now the examples type defaultValues with as Employee and let the controller and the field infer, same as basic concepts and the Lit examples already do. I pasted the updated complete example into a file under packages/lit-form and ran tsc on it with TS 5.4, 5.8 and 5.9: no errors, and field.state.value comes out as string. Before the change it gave both errors above.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Documentation
    • Updated Lit examples to simplify type annotations while preserving the same form setup and behavior.

@changeset-bot

changeset-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: aea5a29

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Lit documentation examples remove explicit generic arguments and callback parameter annotations. The quick-start examples assert defaultValues as Employee.

Changes: Lit documentation examples

Layer / File(s) Summary
Update example type annotations
docs/framework/lit/quick-start.md, docs/framework/lit/guides/basic-concepts.md
The quick-start examples omit the controller generic and assert defaultValues as Employee. Both pages remove explicit FieldApi callback parameter annotations.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other · Severity of issue fixed: Medium

Suggested reviewers: tobysolutions, kushaim

Merge Risk: Minimal · up to aea5a

This is a docs-only fix to Lit examples so they type-check with the current controller. It has no runtime impact and is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the Lit quick-start examples are fixed so they type-check. It names the docs(lit) scope and the affected examples. The raw summary and objectives confirm the change re…
Description check Passed The description follows the template. It has a Changes section that explains the problem (TS2558 and TS2314 errors), the fix (type defaultValues with as Employee and let inference work), and the verif…
Linked Issues check Passed Directly linked issue #2486 has one coding requirement group: make the Lit introductory example type-check with the current TanStackFormController, which needs 12 type arguments. The requested workaro…
Out of Scope Changes check Passed The changes touch only Lit documentation example files: docs/framework/lit/quick-start.md and docs/framework/lit/guides/basic-concepts.md, per the summary. Every hunk I reviewed removes the `<Employee…
Full details: Title check

Explanation

The title names the main change: the Lit quick-start examples are fixed so they type-check. It names the docs(lit) scope and the affected examples. The raw summary and objectives confirm the change removes explicit generics and the FieldApi annotation in quick-start and basic-concepts docs.

Full details: Description check

Explanation

The description follows the template. It has a Changes section that explains the problem (TS2558 and TS2314 errors), the fix (type defaultValues with as Employee and let inference work), and the verification (tsc on TS 5.4, 5.8, 5.9). It links issue #2486. The checklist is filled in, and the release-impact box marks docs-only with no release. Only the changeset box is unchecked, which is correct for a docs-only change.

Full details: Linked Issues check

Explanation

Directly linked issue #2486 has one coding requirement group: make the Lit introductory example type-check with the current TanStackFormController, which needs 12 type arguments. The requested workaround is to omit &lt;Employee&gt; and type defaultValues as Employee. The reviewed diff of docs/framework/lit/quick-start.md at head shows both examples now use new TanStackFormController(this, {...}) with defaultValues: {...} as Employee. This matches the issue workaround. The issue also asks to review the complete example's FieldApi&lt;Employee, 'firstName'&gt; annotation for consistency. The diff removes that annotation from the field callback, so the callback parameter is inferred. The AI summary reports the same removal in docs/framework/lit/guides/basic-concepts.md; I did not inspect that file directly. The issue reproduction is compile-time only, and the PR's local tsc result supports the fix, though the PR does not add an automated test. No coding requirement remains unmet, because the issue requests documentation example changes and this is a docs-only change.

Full details: Out of Scope Changes check

Explanation

The changes touch only Lit documentation example files: docs/framework/lit/quick-start.md and docs/framework/lit/guides/basic-concepts.md, per the summary. Every hunk I reviewed removes the &lt;Employee&gt; type argument or the FieldApi&lt;Employee, 'firstName'&gt; annotation, or adds as Employee to defaultValues. All of these changes implement #2486. No unrelated code, configuration, or package changes appear in the summary. The basic-concepts change is supported only by the AI-generated summary, not by a direct diff read.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: TanStack/form
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 7a213d2
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84ef48d5-c4ce-46a2-8f6a-84987622fc6a
Commits

Reviewing files that changed from the base of the PR and between 7a213d2 and aea5a29.

Files selected for processing: 2

  • docs/framework/lit/guides/basic-concepts.md
  • docs/framework/lit/quick-start.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@LeCarbonator

Copy link
Copy Markdown
Contributor

Thanks!

@LeCarbonator
LeCarbonator merged commit 5de1a8d into TanStack:main Nov 21, 2026
8 checks passed
@victuribdev
victuribdev deleted the docs-lit-quick-start-generics branch November 21, 2026 21:00
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.

Lit quick-start examples pass one type argument to a controller that requires twelve

2 participants