Repository navigation
Conversation
TestConvex<Schema> (where Schema is a constrained generic parameter) is invariant with respect to Schema in TypeScript, so it is not assignable to TestConvex<SchemaDefinition<GenericSchema, boolean>> even though Schema extends SchemaDefinition<GenericSchema, boolean>. This causes a TS2345 error inside register() when users import the test helper and run convex's tsc typecheck against their own schema: error TS2345: Argument of type 'TestConvex<Schema>' is not assignable to parameter of type 'TestConvex<SchemaDefinition<GenericSchema, boolean>>' Fix by casting t to the concrete base type before passing it to workpool.register. The cast is safe at runtime — the object satisfies the interface regardless of the generic parameter used at the call site.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Have you tried with the latest version of |
commit: |
|
updating to the latest workpool, convex-test, convex, etc should fix it - otherwise if you could share the versions you're using via |
|
i confirm the the update works - thank u
…On Wed, Apr 15, 2026 at 8:29 AM Ian Macartney ***@***.***> wrote:
*ianmacartney* left a comment (convex/workflow#239)
<#239 (comment)>
updating to the latest workpool, convex-test, convex, etc should fix it -
otherwise if you could share the versions you're using via npm ls / a
reproduction that would be helpful
—
Reply to this email directly, view it on GitHub
<#239 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAETRW4E72AEMPAH3I7FEMD4V425RAVCNFSM6AAAAACXWACLI2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENJQGA4TANRZGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
glad to hear it! |
Problem
Users who import
@convex-dev/workflow/testand runconvex dev(which invokestscon the convex directory) hit a TS2345 type error inside the package itself:Root cause
TypeScript generics are invariant by default. Inside
register<Schema extends SchemaDefinition<...>>, the localt: TestConvex<Schema>is a constrained generic — it is not assignable toTestConvex<SchemaDefinition<GenericSchema, boolean>>(the concrete base type) even thoughSchema extends SchemaDefinition<GenericSchema, boolean>. This is standard TypeScript variance behaviour.workpool.registerexpects the concrete base type, so passing the constrained generictdirectly fails the type check.Fix
Cast
tto the concrete base type before passing it toworkpool.register. The cast is safe at runtime — the object satisfies the interface regardless of which generic was inferred at the call site.Reproduction
Use
@convex-dev/workflow@0.3.9in a project that importsworkflowTest from "@convex-dev/workflow/test"and runtsc --noEmit -p convex/tsconfig.json. The error appears on line 17 ofsrc/test.ts.Related
Closes / related to #28 (convex-test compatibility).
Summary by CodeRabbit