Describe the bug
form.Subscribe currently allows omitting selector at type level, but in runtime it passes undefined into useStore, which throws:
TypeError: selector is not a function
So there is no TypeScript warning, but the app crashes when rendering <form.Subscribe> without selector.
Your minimal, reproducible example
https://tanstack.com/form/latest/docs/examples/react/simple
Steps to reproduce
const form = useForm({
defaultValues: { name: "" },
onSubmit: async () => {},
})
return (
<form.Subscribe>
{(s) => <button disabled={s.isSubmitting}>Save</button>}
</form.Subscribe>
)
Expected behavior
Either:
- selector should be optional and default internally to identity ((state) => state), or
- selector should be required in types so TS catches this at compile time.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
macOS
TanStack Form adapter
None
TanStack Form version
1.28.4
TypeScript version
5.9.3
Additional context
No response