##// END OF EJS Templates
improved interfaces and more tight type checking
improved interfaces and more tight type checking

File last commit:

r119:86e3aa3c3eea ioc ts support
r120:1b124b65514a ioc ts support
Show More
Bar.ts
33 lines | 617 B | video/mp2t | TypeScriptLexer
import { Foo } from "./Foo";
import { define, dependency } from "./services";
export const service = define<Bar>();
@service.declare({
foo: dependency("foo"),
nested: {
lazy: dependency("foo", {lazy: true})
}
})
export class Bar {
barName = "bar";
_v: Foo | undefined;
constructor(_opts?: {
foo?: Foo;
nested?: {
lazy: () => Foo
}
}) {
if (_opts && _opts.foo)
this._v = _opts.foo;
}
getFoo() {
if (this._v === undefined)
throw new Error("The foo isn't set");
return this._v;
}
}