Skip to content

Conversation

ozanmakes
Copy link
Contributor

BetterAuth class accepts a type parameter UserId. However if used, it causes a type error when passing it to convexAdapter because this function only accepts BetterAuth

This change fixes code such as the following:

export const betterAuthComponent = new BetterAuth<Id<"users">>(components.betterAuth, {
  authFunctions,
  publicAuthFunctions,
});

// ...

betterAuth({
    database: convexAdapter(ctx, betterAuthComponent),
    ...
})

Before this would give the type error

Argument of type 'BetterAuth<Id<"users">>' is not assignable to parameter of type 'BetterAuth<string>'.
  Types of property 'createAuthFunctions' are incompatible.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

BetterAuth class accepts a type parameter UserId. However if used, it causes a type error when passing it to convexAdapter because this function only accepts BetterAuth<string>

This change fixes code such as the following:

export const betterAuthComponent = new BetterAuth<Id<"users">>(components.betterAuth, {
  authFunctions,
  publicAuthFunctions,
});


...

betterAuth({
    database: convexAdapter(ctx, betterAuthComponent),
    ...
})

Before this would give the type error

Argument of type 'BetterAuth<Id<"users">>' is not assignable to parameter of type 'BetterAuth<string>'.
  Types of property 'createAuthFunctions' are incompatible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant