-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types: allow void for generic type #227
Conversation
WalkthroughThe changes involve an update to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant KindeUser
User->>KindeUser: Create instance with no type argument
KindeUser->>KindeUser: Default type set to void
User->>KindeUser: Create instance with specific type argument
KindeUser->>KindeUser: Type set to specified argument
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (1)
types.d.ts (1)
160-162
: LGTM! The change improves developer experience.The modification to make the generic type parameter optional with
void
as default is a good improvement. It simplifies usage when custom properties aren't needed while maintaining backward compatibility and type safety.Consider adding a JSDoc comment to document the generic type parameter usage:
+/** + * Represents a Kinde user with optional custom properties. + * @template T - Type of custom user properties. Defaults to void when no custom properties are needed. + */ export interface KindeUser<T = void> extends KindeUserBase { properties?: KindeUserProperties<T>; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- types.d.ts (1 hunks)
🔇 Additional comments (1)
types.d.ts (1)
160-162
: Verify usage patterns in the codebase.Let's ensure this change doesn't introduce any unexpected issues with existing usage patterns.
✅ Verification successful
Change is safe but requires documentation update
The verification shows this change is backwards compatible since:
- The default type parameter
T = void
maintains existing behavior- All current usages already specify explicit type parameters:
Record<string, string>
in type definitionsRecord<string, any>
and genericT
in session handlingCustomPropertyType
in user object generationHowever, the change from
Record<string, any>
tovoid
default should be documented.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check current usage patterns of KindeUser to ensure compatibility # Test 1: Find direct usage of KindeUser type echo "=== Direct KindeUser usage ===" rg "KindeUser" --type ts # Test 2: Look for potential type parameter specifications echo -e "\n=== KindeUser type parameter usage ===" rg "KindeUser<" --type tsLength of output: 1483
Explain your changes
Suppose there is a related issue with enough detail for a reviewer to understand your changes fully. In that case, you can omit an explanation and instead include either “Fixes #XX” or “Updates #XX” where “XX” is the issue number.
Checklist
🛟 If you need help, consider asking for advice over in the Kinde community.