fluent提供inversify-binding-decorators 4

时间:2018-06-08 04:05:06

标签: typescript inversifyjs

我无法找到如何让新的inversify绑定装饰器(4.0)工作......

我认为我的代码中出现了一个愚蠢的错误,但我无法找到它......

import { Container, interfaces as inversifyInterfaces } from "inversify";
import { fluentProvide, buildProviderModule, provide } from "inversify-binding-decorators";
import "reflect-metadata";
import interfaces from "inversify-binding-decorators/dts/interfaces/interfaces";

const container = new Container();
const provideFluent = fluentProvide(container);

export function ProvideSingleton(identifier: inversifyInterfaces.ServiceIdentifier<any>) {
    return provideFluent(identifier)
       .inSingletonScope()
        .done(true);
}

container.load(buildProviderModule());

export { container };

现在,这里有2个错误:

fluentProvide(container) --> Argument of type 'Container' is not assignable to parameter of type 'string | symbol | Newable<any> | Abstract<any>'.

输入&#39; Container&#39;不能分配类型&#39;摘要&#39;。     物业&#39;原型&#39;类型&#39;容器&#39;

中缺少
return provideFluent(identifier) --> Cannot invoke an expression whose type lacks a call signature. Type 'ProvideInWhenOnSyntax<any>' has no compatible call signatures.

如何解决这些问题?

非常感谢

0 个答案:

没有答案