ProvenPin Install

TanStack form-core sync validation and submit: working versions (tested 2026-10-15)

Use @tanstack/form-core FormApi with field validators and onSubmit to validate values offline without a UI.

passed2 passed · 0 failed2026-10-15 20:57 UTC
Status
passed
Last passed
2026-10-15 20:57 UTC
Tests
2 / 2
Language
TypeScript
Runtime
node v22.23.3
pinned versions3
@tanstack/form-core@1.33.5@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false
npm test
test environment
node v22.23.3
linux 6.17.0-1022-azure
x64
runner: github-actions 38805962781

The code

Exactly the files that passed. Your agent can pull them with get_recipe("tanstack-form-core-validation") (install), or see them on GitHub.

package.json
{
  "name": "tanstack-form-core-validation",
  "private": true,
  "type": "module",
  "scripts": {
    "test": "node --import tsx --test test/*.test.ts"
  },
  "dependencies": {
    "@tanstack/form-core": "1.33.5"
  },
  "devDependencies": {
    "@types/node": "26.6.5",
    "tsx": "4.23.15"
  }
}
src/form.ts
import { FormApi } from "@tanstack/form-core";

export type Signup = { email: string; age: number };

export function createSignupForm(onValid: (v: Signup) => void) {
  const form = new FormApi<Signup>({
    defaultValues: { email: "", age: 0 },
    onSubmit: async ({ value }) => {
      onValid(value);
    },
  });
  form.mount();
  return form;
}

export function emailError(email: string) {
  if (!email.includes("@")) return "email must include @";
  return undefined;
}

export function ageError(age: number) {
  if (age < 18) return "must be 18+";
  return undefined;
}
test/form.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { ageError, createSignupForm, emailError } from "../src/form.ts";

test("validators catch bad email and age", () => {
  assert.equal(emailError("not-an-email"), "email must include @");
  assert.equal(emailError("[email protected]"), undefined);
  assert.equal(ageError(16), "must be 18+");
  assert.equal(ageError(21), undefined);
});

test("form submits cleaned values", async () => {
  let submitted: { email: string; age: number } | undefined;
  const form = createSignupForm((v) => {
    submitted = v;
  });
  form.setFieldValue("email", "[email protected]");
  form.setFieldValue("age", 30);
  await form.handleSubmit();
  assert.deepEqual(submitted, { email: "[email protected]", age: 30 });
});

Connect to ProvenPin

Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.

terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp

Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.