Context
server/worldmonitor/leads/v1/submit-contact.ts and register-interest.ts call Convex mutations by string name cast as any:
```ts
await client.mutation('contactMessages:submit' as any, { ... })
await client.mutation('registerInterest:register' as any, { ... })
```
Carried over from legacy `api/contact.js` / `api/register-interest.js`. Convex generates typed handles (`api.contactMessages.submit` etc.) that give us compile-time verification the mutation exists with the expected arg shape. The string form silently breaks when mutations are renamed.
Flagged in the #3242 review as a follow-up (low priority).
Fix
Import the typed `api` object from `convex/_generated/api` and swap the string names:
```ts
import { api } from '../../../../convex/_generated/api';
await client.mutation(api.contactMessages.submit, { ... })
await client.mutation(api.registerInterest.register, { ... })
```
Check the generated `_generated/api.d.ts` for the correct import path. May need to adjust tsconfig paths if `convex/` isn't currently in the api tsconfig scope.
Related
Context
server/worldmonitor/leads/v1/submit-contact.tsandregister-interest.tscall Convex mutations by string name cast as any:```ts
await client.mutation('contactMessages:submit' as any, { ... })
await client.mutation('registerInterest:register' as any, { ... })
```
Carried over from legacy `api/contact.js` / `api/register-interest.js`. Convex generates typed handles (`api.contactMessages.submit` etc.) that give us compile-time verification the mutation exists with the expected arg shape. The string form silently breaks when mutations are renamed.
Flagged in the #3242 review as a follow-up (low priority).
Fix
Import the typed `api` object from `convex/_generated/api` and swap the string names:
```ts
import { api } from '../../../../convex/_generated/api';
await client.mutation(api.contactMessages.submit, { ... })
await client.mutation(api.registerInterest.register, { ... })
```
Check the generated `_generated/api.d.ts` for the correct import path. May need to adjust tsconfig paths if `convex/` isn't currently in the api tsconfig scope.
Related