Skip to content

Linting error (@typescript-eslint/unbound-method) #835

Closed Answered by stalniy
ericvoshall asked this question in Q&A
Discussion options

You must be logged in to vote

AbilityBuilder can/cannot methods are very complicated in terms of type inference.

Eslint thinks the method is unbound because it cannot detect bound methods created with .bind

so methods are bound be sure.

I’ve tried to rewrite AbilityBuilder so eslint understand that methods are bound but I remember it brought even more complexities. That’s why those changes have not been released

If you want to get rid of that issue with deli t just use a variable

const b = new AbilityBuilder<AppAbility>(createMongoAbility);

b.can()

Replies: 1 comment 1 reply

Comment options

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

Answer selected by ericvoshall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants