Skip to content

fix(backend): correct createInvitationBulk return type to `Promise<…#7136

Merged
jacekradko merged 2 commits into
clerk:mainfrom
mario-jerkovic:fix/clerk-backed-invitations-signature
Jan 29, 2026
Merged

fix(backend): correct createInvitationBulk return type to `Promise<…#7136
jacekradko merged 2 commits into
clerk:mainfrom
mario-jerkovic:fix/clerk-backed-invitations-signature

Conversation

@mario-jerkovic

@mario-jerkovic mario-jerkovic commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Description

  • Corrects createInvitationBulk to return an array of Invitation instead of a single Invitation.
  • Aligns the method’s return type with the bulk REST endpoint semantics and existing bulk invitation patterns.
  • This was caught by CodeRabbit in this PR

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@changeset-bot

changeset-bot Bot commented Nov 4, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 43abdab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@clerk/backend Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Nov 4, 2025

Copy link
Copy Markdown

@mario-jerkovic is attempting to deploy a commit to the Clerk Production Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 4, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The pull request corrects the return type annotation for the createInvitationBulk method in the @clerk/backend package. The method now correctly declares that it returns an array of invitations rather than a single invitation, aligning the type signature with actual behavior.

Changes

Cohort / File(s) Summary
Changeset Release Documentation
\.changeset/spotty-terms-heal\.md
Adds changeset recording a patch-level fix for @clerk/backend: corrects createInvitationBulk return type to Promise<Invitation[]>.
Invitation API Type Fix
packages/backend/src/api/endpoints/InvitationApi\.ts
Updates createInvitationBulk method's return type annotation from Promise<Invitation> to Promise<Invitation[]> and adjusts the generic parameter in the underlying request call.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Type correction is straightforward and localized to method signature
  • Changeset documentation is formulaic
  • No logic changes or behavioral modifications involved

Poem

🐰 A bulk of invites now return as they should,
No longer one, but many—mistype understood!
The array bounds this little fix with care,
Hop hop, the types align everywhere! 🎉

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: correcting the return type of createInvitationBulk to Promise-based type, which aligns with the changeset and code modifications.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/backend/src/api/endpoints/InvitationApi.ts (1)

69-75: Consider adding explicit return type and JSDoc.

Per the coding guidelines, public APIs should have explicit return types and JSDoc comments. While this isn't critical for the current bug fix, consider adding them for consistency:

+  /**
+   * Creates multiple invitations in a single request.
+   *
+   * @param params - Array of invitation parameters
+   * @returns Promise resolving to array of created invitations
+   */
-  public async createInvitationBulk(params: CreateBulkParams) {
+  public async createInvitationBulk(params: CreateBulkParams): Promise<Invitation[]> {
     return this.request<Invitation[]>({

Note: Other methods in this class also lack explicit return types and JSDoc, so this could be addressed separately for the entire class.

As per coding guidelines

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d9d0e88 and cb9c320.

📒 Files selected for processing (2)
  • .changeset/spotty-terms-heal.md (1 hunks)
  • packages/backend/src/api/endpoints/InvitationApi.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/backend/src/api/endpoints/InvitationApi.ts
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/spotty-terms-heal.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/backend/src/api/endpoints/InvitationApi.ts (2)

70-70: Correct type fix for bulk invitation creation.

The change from Invitation to Invitation[] properly aligns the return type with the bulk operation semantics. A method that accepts an array of parameters should return an array of results.


69-75: No callers of createInvitationBulk exist in the codebase.

Comprehensive search across all TypeScript and JavaScript files found zero usages of this method. The method is only defined, never called within the codebase, so there are no existing callers to verify or update. The return type Promise<Invitation[]> is correctly declared and will be properly typed for any future callers.

.changeset/spotty-terms-heal.md (1)

1-5: LGTM! Changeset properly documents the fix.

The changeset is correctly formatted and accurately describes the bug fix. The patch version bump is appropriate for a type correction that maintains backward compatibility at runtime while potentially breaking TypeScript compilation for incorrect usage.

@github-actions

Copy link
Copy Markdown
Contributor

Hello 👋

We currently close PRs after 60 days of inactivity. It's been 50 days since the last update here. If we missed this PR, please reply here. Otherwise, we'll close this PR in 10 days.

Thanks for being a part of the Clerk community! 🙏

@github-actions github-actions Bot added the Stale label Jan 29, 2026
@mario-jerkovic

Copy link
Copy Markdown
Contributor Author

Hello 👋

We currently close PRs after 60 days of inactivity. It's been 50 days since the last update here. If we missed this PR, please reply here. Otherwise, we'll close this PR in 10 days.

Thanks for being a part of the Clerk community! 🙏

You've missed this PR

@jacekradko jacekradko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @mario-jerkovic ! Sorry we got to it so late.

@jacekradko jacekradko merged commit a00d75a into clerk:main Jan 29, 2026
3 of 4 checks passed
jacekradko pushed a commit that referenced this pull request Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants