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

Ouverte Adaptée aux débutants
#2,486 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
88/100
Type d'issue
Documentation
Clarté
Clairement spécifiée
Activité
Active
Stack technique
typescript
Domaine
documentation

Piste de recherche

Commence dans docs/framework/lit/quick-start.md aux deux exemples autour de la ligne 16 et compare-les aux douze paramètres génériques du contrôleur à packages/lit-form/src/tanstack-form-controller.ts ligne 226. Reproduis en compilant le snippet de démarrage avec TypeScript strict mode ; terminé signifie que les deux exemples Lit quick-start passent la vérification de types, probablement en supprimant le seul argument <Employee> et en typant defaultValues à la place. Vérifie l’annotation FieldApi<Employee, 'firstName'> de l’exemple complet pour la cohérence.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Hullo folks,

I’m doing some research for Tessl Code Review and ran it against your repo. It flagged a potential issue, and I figured it made sense to share it with you:

Describe the bug

The Lit quick-start still constructs new TanStackFormController<Employee>(this, ...), but the current controller has twelve required generic parameters. Copying that starter into a TypeScript Lit component produces TS2558.

This surfaced in a retrospective review of merged PR #2252. The same mismatch remains at 7a213d2: both quick-start examples supply one argument, while the class declaration supplies no defaults for the remaining parameters.

Minimal reproduction
import { LitElement } from 'lit';
import { TanStackFormController } from '@tanstack/lit-form';

interface Employee {
  firstName: string;
  lastName: string;
  employed: boolean;
  jobTitle: string;
}

export class TestForm extends LitElement {
  form = new TanStackFormController<Employee>(this, {
    defaultValues: {
      firstName: '', lastName: '', employed: false, jobTitle: '',
    },
  });
}

Codex ran TypeScript 5.8.3 with --strict --noEmit against the actual controller source from this checkout, resolving form-core 1.33.5, lit-store 0.13.2 and Lit 3.3.1. The only diagnostic was:

error TS2558: Expected 12 type arguments, but got 1.

The public documentation above is the source example for reproducing this.

Expected behavior / workaround

The introductory example should type-check with the current controller. Omitting <Employee> and typing defaultValues as Employee lets the controller infer its generics; that control compiled without diagnostics in the same environment.

The complete example also explicitly annotates FieldApi<Employee, 'firstName'>, so reviewing its generic annotations together would help keep the page consistent.

Environment

Current checkout 7a213d2 (lit-form package version 1.25.5), TypeScript 5.8.3, macOS 27.2. This verifies the compile-time starter issue; it does not claim a rendered Lit application test.

Full transparency: I work at Tessl, and we've spotted that using Tessl Code Review - using repository-level context and specific review lenses that improve over time through feedback. That’s how this finding surfaced.

We’re just getting started and want to offer the tool free to open-source projects. If this is useful, happy to give you access.

Bap

Langage dominant
TypeScript
Étoiles
6.8k
Forks
717
Merge moyen
5 j 22 h
PR mergées (30 j)
14

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TanStack/form

Toutes les issues de TanStack/form

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.