NetanelBasal / helpful-decorators

Helpful decorators for typescript projects

Home Page:https://netbasal.com/create-and-test-decorators-in-javascript-85e8d5cf879c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bind decorator expects 3 parameters

hakimio opened this issue · comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request

Current behavior

Trying to use @bind decorator without any arguments results in "Expected 3 arguments but got 0" TypeScript error.

Expected behavior

@bind() decorator should work without any arguments.

Minimal reproduction of the problem with instructions

Try to use @bind() decorator in Angular 9 project.

Environment


helpful-decorators version: 2.0.6


Browser:
- [x] Chrome (desktop) version XX
 
For Tooling issues:
- Node version: 12
- Platform:  Windows

Others:
TypeScript: 3.8.3

You're welcome to submit a PR. Thanks.

I think the only thing you have to do to fix this is wrap it in another function:

export function bind() {
    return function (target: any, key: string, descriptor: PropertyDescriptor): PropertyDescriptor {
        // ...
    }
}

Ok, sorry, it works without paranthesis.