Skip to content

fix(types): Avoid using ts-expect-error as it may fail for hosting apps #2313

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

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/friendly-parrots-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
8 changes: 4 additions & 4 deletions packages/types/src/organizationMembership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export interface OrganizationMembershipResource extends ClerkResource {
}

export type OrganizationCustomPermissionKey = 'permission' extends keyof ClerkAuthorization
? // @ts-expect-error Typescript cannot infer the existence of the `permission` key even if we checking it above
? // @ts-ignore Typescript cannot infer the existence of the `permission` key even if we checking it above
ClerkAuthorization['permission']
: Base['permission'];

export type OrganizationCustomRoleKey = 'role' extends keyof ClerkAuthorization
? // @ts-expect-error Typescript cannot infer the existence of the `role` key even if we checking it above
? // @ts-ignore Typescript cannot infer the existence of the `role` key even if we checking it above
ClerkAuthorization['role']
: Base['role'];

Expand All @@ -62,7 +62,7 @@ export type OrganizationCustomRoleKey = 'role' extends keyof ClerkAuthorization
* these types will no longer match a developer's custom logic.
*/
export type MembershipRole = 'role' extends keyof ClerkAuthorization
? // @ts-expect-error Typescript cannot infer the existence of the `role` key even if we checking it above
? // @ts-ignore Typescript cannot infer the existence of the `role` key even if we checking it above
// Disabling eslint rule because the error causes the type to become any when accessing a property that does not exist
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
ClerkAuthorization['role'] | 'admin' | 'basic_member' | 'guest_member'
Expand All @@ -81,7 +81,7 @@ export type OrganizationSystemPermissionKey =
* System permissions are only accessible from FAPI and client-side operations/utils
*/
export type OrganizationPermissionKey = 'permission' extends keyof ClerkAuthorization
? // @ts-expect-error Typescript cannot infer the existence of the `permission` key even if we checking it above
? // @ts-ignore Typescript cannot infer the existence of the `permission` key even if we checking it above
// Disabling eslint rule because the error causes the type to become any when accessing a property that does not exist
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
ClerkAuthorization['permission'] | OrganizationSystemPermissionKey
Expand Down