-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
From the docs, query.batch accepts a validator, which lets say accepts TypeA and validates it to TypeB (e.g. string to Date), the remote func will accept an array of TypeB, it will fetch all of them in a single db call, and then it must return a function, which accepts two params, first of type TypeB and second index of type number. The batch function itself should be called with a single TypeA variable.
Typescript does confirm this behavior, and the returned function's argument type is supposed to be validated TypeB, but this is not the case, and it is TypeA regardless of the validation library and the method of validation.
Reproduction
- Create a sveltekit project, enable remote functions and async
- Make a
query.batchfunction that has av.pipe(v.string(), v.toDate())orz.coerce.date<string>()or similar two-type validator. - Check the expected vs actual type of the first parameter in the return function
Uncommenting line 17 results in an internal error, since x is actually a string, as opposed to a date.
Logs
4:04:18 PM [vite] (ssr) page reload src/routes/test.remote.ts
[
2026-01-01T00:00:00.000Z,
2025-12-01T00:00:00.000Z,
2025-11-01T00:00:00.000Z
] object
{
'2026-01-01T00:00:00.000Z': 2026,
'2025-12-01T00:00:00.000Z': 2025,
'2025-11-01T00:00:00.000Z': 2025
}
X 2026-01-01 string
X 2025-12-01 string
X 2025-11-01 stringSystem Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 20.19.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@sveltejs/adapter-auto: ^7.0.0 => 7.0.0
@sveltejs/kit: ^2.49.2 => 2.49.2
@sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
svelte: ^5.46.1 => 5.46.1
vite: ^7.2.2 => 7.3.0Severity
serious, but I can work around it
Additional Information
The system info is from the repl, please tell me if I need to provide mine. I am already using the latest versions of svelte* packages.