Skip to content

Cannot access root-level .issues() in schema-less form #14892

@sillvva

Description

@sillvva

Describe the bug

When you have a form with no schema, the invalid method is available, but form.fields is of type never, preventing access to the root-level issues.

export const test = form((invalid) => {
	throw invalid('testing');
});

test.fields.issues(); // type error
//   ^? never

Reproduction

Copy this into any *.remote.ts file:

export const test = form((invalid) => {
	throw invalid('testing');
});

test.fields.issues(); // type error
//   ^? never

It works, but it has an incorrect type error.

Logs

System Info

System:
    OS: macOS 26.0.1
    CPU: (16) arm64 Apple M4 Max
    Memory: 1.23 GB / 48.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - /Users/sillvva/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - /Users/sillvva/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 10.19.0 - /Users/sillvva/.nvm/versions/node/v22.12.0/bin/pnpm
    bun: 1.2.20 - /Users/sillvva/.bun/bin/bun
  Browsers:
    Firefox: 144.0
    Safari: 26.0.1
  npmPackages:
    @sveltejs/kit: ^2.47.1 => 2.48.4

Severity

annoyance

Additional Information

Proposed solution. Change this:

fields: Input extends void ? never : RemoteFormFields<Input>;

To this:

	fields: Input extends void
		? {
				issues(): RemoteFormIssue[] | undefined;
			}
		: RemoteFormFields<Input>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions