@microsoft/fast-foundation > optional
optional variable
A decorator that allows you to optionally inject a dependency depending on whether the [[Key
]] is present, for example:
optional: (key: any) => any
Example 1
class Foo {
constructor( @inject('mystring') public str: string = 'somestring' )
}
container.get(Foo); // throws
would fail