Skip to content

fluentProvide - example #143

@wiulma

Description

@wiulma

Could you please provide a full fluentProvide example?
I have this kind of issue:

import { Container, decorate, inject, injectable, interfaces as inversifyInterfaces, named } from "inversify";
import { fluentProvide, buildProviderModule } from "inversify-binding-decorators";
import "reflect-metadata";

const container = new Container();
const provideFluent = fluentProvide(container);
....
export function ProvideAsSingleton(symbol: inversifyInterfaces.ServiceIdentifier<any>): any {
    return provideFluent(symbol).inSingletonScope().done(true);
}
container.load(buildProviderModule());

export { container };

The issue is at:

const provideFluent = fluentProvide(container);

the error is:

[ts]
Argument of type 'Container' is not assignable to parameter of type 'string | symbol | Newable<any> | Abstract<any>'.
  Type 'Container' is not assignable to type 'Abstract<any>'.
    Property 'prototype' is missing in type 'Container'.

How can I use fluent provider?
thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions