Skip to content

Some types are not updated when combined with organization plugin #33

Description

@manish-baghel

Some organization plugin types are not inferred when used from within withCloudflare wrapper.
(Workaround 1 - without wrapper)
(Workaround 2 - with wrapper]

Configuration used:

return betterAuth({
        ...withCloudflare(
            {
                autoDetectIpAddress: true,
                geolocationTracking: true,
                cf: cf || {},
                postgres: {
                    db,
                    options: {
                        usePlural: true,
                        debugLogs: false,
                    },
                },
                kv: env?.KV as KVNamespace,
            },
            {
                plugins: [
                    admin(),
                    organization(),
                    apiKey(),
                    lastLoginMethod(),
                ],
            }
        )});

Logs:

➜ npm run build

> build
> npx tsc --noEmit

src/index.ts:100:25 - error TS2339: Property 'activeOrganizationId' does not exist on type '{ id: string; createdAt: Date; updatedAt: Date; userId: string; expiresAt: Date; token: string; ipAddress?: string | null | undefined; userAgent?: string | null | undefined; }'.

100     if (session.session.activeOrganizationId) {
                            ~~~~~~~~~~~~~~~~~~~~

src/index.ts:102:57 - error TS2339: Property 'getActiveMemberRole' does not exist on type 'InferAPI<{ ok: { <AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({ body?: undefined; } & { method?: "GET" | undefined; } & { query?: Record<string, any> | undefined; } & { params?: Record<string, any> | undefined; } & { ...; } & { ...; } & { ...; } & { ...; }) | undefined): ...'.

102             const { role: orgRoleStr } = await auth.api.getActiveMemberRole({ headers: reqHeaders });
                                                            ~~~~~~~~~~~~~~~~~~~

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions