Skip to content

Conversation

@gabrielseco
Copy link
Collaborator

Problem

When using createHeadlessForm() with async hooks like useQuery, TypeScript couldn't infer the return type, resulting in unknown type:

const { data } = useQuery({  queryFn: async () => createHeadlessForm(schema),})// ❌ data is typed as 'unknown' - no intellisense or type safety

Solution

Export the core types from the public API so TypeScript can properly infer them:
const { data } = useQuery({ queryFn: async () => createHeadlessForm(schema),})// ✅ data is now properly typed

Tested in local with the https://github.com/remoteoss/remote-flows package to make sure that it worked

@gabrielseco gabrielseco self-assigned this Nov 21, 2025
@gabrielseco gabrielseco merged commit a9fd050 into main Nov 21, 2025
5 checks passed
@gabrielseco gabrielseco deleted the fix-typescript-issue-with-create-headless-form branch November 21, 2025 15:55
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.

4 participants