File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ---
Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ interface Base {
8
8
role : string ;
9
9
}
10
10
11
+ interface Placeholder {
12
+ permission : unknown ;
13
+ role : unknown ;
14
+ }
15
+
11
16
declare global {
12
17
interface ClerkAuthorization { }
13
18
}
@@ -45,14 +50,16 @@ export interface OrganizationMembershipResource extends ClerkResource {
45
50
update : ( updateParams : UpdateOrganizationMembershipParams ) => Promise < OrganizationMembershipResource > ;
46
51
}
47
52
48
- export type OrganizationCustomPermissionKey = 'permission' extends keyof ClerkAuthorization
49
- ? // @ts -ignore Typescript cannot infer the existence of the `permission` key even if we checking it above
50
- ClerkAuthorization [ 'permission' ]
53
+ export type OrganizationCustomPermissionKey = ClerkAuthorization extends Placeholder
54
+ ? ClerkAuthorization [ 'permission' ] extends string
55
+ ? ClerkAuthorization [ 'permission' ]
56
+ : Base [ 'permission' ]
51
57
: Base [ 'permission' ] ;
52
58
53
- export type OrganizationCustomRoleKey = 'role' extends keyof ClerkAuthorization
54
- ? // @ts -ignore Typescript cannot infer the existence of the `role` key even if we checking it above
55
- ClerkAuthorization [ 'role' ]
59
+ export type OrganizationCustomRoleKey = ClerkAuthorization extends Placeholder
60
+ ? ClerkAuthorization [ 'role' ] extends string
61
+ ? ClerkAuthorization [ 'role' ]
62
+ : Base [ 'role' ]
56
63
: Base [ 'role' ] ;
57
64
58
65
/**
You can’t perform that action at this time.
0 commit comments