Skip to content

Conversation

@abdelrahman-zaki
Copy link

@abdelrahman-zaki abdelrahman-zaki commented Oct 8, 2025

Explain your changes

Extend V union to include { id, name }[] for the organizations claim. Update JSDoc @returns to match TypeScript signature.

Checklist

🛟 If you need help, consider asking for advice over in the Kinde community.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 8, 2025

Walkthrough

The getClaim function in lib/utils/token/getClaim.ts expands its generic value type V to include an array of objects { id: string; name: string }[] and updates the JSDoc and signature return types accordingly. No control flow or logic changes were made.

Changes

Cohort / File(s) Change Summary
Token claim utils
lib/utils/token/getClaim.ts
Expanded generic V from `string

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Review lib/utils/token/getClaim.ts for correct TypeScript inference and downstream usages where the claim value is consumed (especially places assuming primitive/string[]).

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "fix(types): support organizations {id,name}[] in getClaim" is clear, specific, and directly describes the main change in the changeset. The title accurately conveys that the getClaim function's type system is being updated to support organization claims with an {id, name}[] structure, which aligns perfectly with the raw summary showing the V union type was expanded to include { id: string; name: string }[]. The title uses conventional commit style and avoids vague terminology.
Description Check ✅ Passed The pull request description is clearly related to the changeset. It explicitly states "Extend V union to include { id, name }[] for the organizations claim" and "Update JSDoc @returns to match TypeScript signature," both of which directly correspond to the changes shown in the raw summary. The description is appropriately concise without being vague, and it contains the expected contributing guidelines checklist that confirms the contributor's compliance with repository standards.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56be052 and 23dded7.

📒 Files selected for processing (1)
  • lib/utils/token/getClaim.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/utils/token/getClaim.ts (1)
lib/utils/token/index.ts (1)
  • getClaim (11-11)
🔇 Additional comments (1)
lib/utils/token/getClaim.ts (1)

10-10: LGTM! Organizations claim type support added correctly.

The extension of the V generic to include { id: string; name: string }[] properly supports the organizations claim format. The change is backward compatible.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@abdelrahman-zaki abdelrahman-zaki requested a review from a team as a code owner October 27, 2025 15:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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)
lib/utils/token/getClaim.ts (1)

8-8: JSDoc improvement addresses past feedback.

The updated @returns annotation now correctly documents the full return structure { name, value } instead of just the value type, resolving the previous review concern.

However, the JSDoc hardcodes the default V union. When callers specify a custom type (e.g., getClaim<T, boolean>), the JSDoc will still show the full union, which may be misleading.

Consider a more generic JSDoc that defers to TypeScript's type system:

-* @returns { Promise<{ name: keyof T; value: string | number | string[] | { id: string; name: string }[] } | null> }
+* @returns {Promise<{ name: keyof T; value: V } | null>} Object containing the claim name and value (based on generic type V), or null if claims unavailable
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23dded7 and 5c39281.

📒 Files selected for processing (1)
  • lib/utils/token/getClaim.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/utils/token/getClaim.ts (1)
lib/utils/token/index.ts (1)
  • getClaim (11-11)
🔇 Additional comments (1)
lib/utils/token/getClaim.ts (1)

10-10: LGTM! Appropriate type expansion for organizations claim.

The expanded V generic correctly adds support for { id: string; name: string }[] to handle the organizations claim format while maintaining backward compatibility with existing claim types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant