inversify-binding-decorators icon indicating copy to clipboard operation
inversify-binding-decorators copied to clipboard

Usage with ESLint

Open j opened this issue 6 years ago • 2 comments

When you're using a class as the type, you get the error: @typescript-eslint/no-use-before-define.

I'd rather not disable this line. Any chance to make @provide() without any arguments passed in default to the class type?

j avatar Aug 13 '19 18:08 j

#186

j avatar Aug 13 '19 18:08 j

I encountered the error ReferenceError: Cannot access before initialization, and I really need this pull requests.

If someone want to use this pull request without any modifying original source before merging,
Use your own decorator like

import { interfaces } from 'inversify';
import { provide } from 'inversify-binding-decorators';

function provideAuto(serviceIdentifier?: interfaces.ServiceIdentifier<any>, force?: boolean) {
  return function (target: any) {
    const result = provide(serviceIdentifier || target, force)(target);

    return result;
  };
}

export default provideAuto;

Web-Engine avatar Jun 22 '21 09:06 Web-Engine