Skip to content
Discussion options

You must be logged in to vote

Wow, I didn't expect that. I've seen you pinged the issue, thanks 👍

For anyone who had the same problem, I've used this workaround to trick Typescript:

public static async isAdmin(user: User) {
  const roles = await user.related('roles').query().select('name')
  return roles.some((role) => role.name == 'admin')
}

public async isAdmin() {
  return await User.isAdmin(this)
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@keef3ar
Comment options

Answer selected by Yeboster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants