A
arktype3mo ago
francis

Is there currently a known issue with arktype + trpc compatibility?

This is with latest RC.12
TypeError: Cannot read properties of undefined (reading 'traverse')
at assert (/node_modules/@ark/schema/out/roots/root.js:80:29)
at inputMiddleware (/node_modules/@trpc/server/dist/index.mjs:278:33)
at callRecursive (/node_modules/@trpc/server/dist/index.mjs:452:38)
at Object.next (/node_modules/@trpc/server/dist/index.mjs:461:32)
at eval (/src/lib/trpc/middleware.ts:21:15)
at callRecursive (/node_modules/@trpc/server/dist/index.mjs:452:38)
at resolve (/node_modules/@trpc/server/dist/index.mjs:482:30)
at callProcedure (/node_modules/@trpc/server/dist/config-d5fdbd39.mjs:155:12)
at inputToProcedureCall (/node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:46:28)`
TypeError: Cannot read properties of undefined (reading 'traverse')
at assert (/node_modules/@ark/schema/out/roots/root.js:80:29)
at inputMiddleware (/node_modules/@trpc/server/dist/index.mjs:278:33)
at callRecursive (/node_modules/@trpc/server/dist/index.mjs:452:38)
at Object.next (/node_modules/@trpc/server/dist/index.mjs:461:32)
at eval (/src/lib/trpc/middleware.ts:21:15)
at callRecursive (/node_modules/@trpc/server/dist/index.mjs:452:38)
at resolve (/node_modules/@trpc/server/dist/index.mjs:482:30)
at callProcedure (/node_modules/@trpc/server/dist/config-d5fdbd39.mjs:155:12)
at inputToProcedureCall (/node_modules/@trpc/server/dist/resolveHTTPResponse-2fc435bb.mjs:46:28)`
This occurs when I do .input(type(anything).assert). If I do something such as .input((i) => type(anything).assert(i)), it works fine. How on earth is it ending up with this being undefined when it is run this way?
2 Replies
francis
francisOP3mo ago
aha, you can no longer pass an arktype assert around the way trpc docs show
let test = type("string[]")
let testFn = (inputFn) => inputFn({})
testFn(test.assert)
let test = type("string[]")
let testFn = (inputFn) => inputFn({})
testFn(test.assert)
Uncaught TypeError: Cannot read properties of undefined (reading 'traverse')
francis
francisOP3mo ago
GitHub
Type .assert functions no longer usable as passed variables witho...
Report a bug .assert functions from types are no longer usable as passed-around functions. They must be explicitly bound. This breaks trpc's arktype integration, where they describe using .inpu...
Want results from more Discord servers?
Add your server