-
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: fix permission types and userOrg default value #228
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,7 +303,7 @@ export type KindeState = { | |
isAuthenticated: boolean | null; | ||
isLoading: boolean | null; | ||
organization: KindeOrganization; | ||
permissions: KindePermissions; | ||
permissions: KindePermissions | []; | ||
user: { | ||
id: string; | ||
email: string | null; | ||
|
@@ -337,7 +337,7 @@ export type KindeState = { | |
getPermission: ( | ||
key: string | ||
) => {isGranted: boolean; orgCode: string | null} | null; | ||
getPermissions: () => KindePermissions; | ||
getPermissions: () => KindePermissions | []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure consistent typing between permissions property and getPermissions method. The return type of - getPermissions: () => KindePermissions | [];
+ getPermissions: () => KindePermissions | { permissions: []; orgCode: null }; This maintains type consistency and prevents potential type mismatches between the property and its getter method.
|
||
getStringFlag: ( | ||
code: string, | ||
defaultValue: string | ||
|
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.
Consider using a more specific union type for permissions.
The current type
KindePermissions | []
could lead to runtime errors when code expects thepermissions
andorgCode
properties. Consider using a more type-safe alternative:This ensures that even when empty, the permissions object maintains a consistent structure, preventing potential runtime errors.
📝 Committable suggestion