| 838 | } |
| 839 | |
| 840 | @injectable() |
| 841 | class DieselCarFactory implements CarFactory { |
| 842 | private readonly _dieselFactory: (displacement: number) => Engine; |
| 843 | constructor( |
| 844 | @inject('Factory<Engine>') |
| 845 | factory: (category: string) => (displacement: number) => Engine, |
| 846 | ) { |
| 847 | this._dieselFactory = factory('diesel'); |
| 848 | } |
| 849 | public createEngine(displacement: number): Engine { |
| 850 | return this._dieselFactory(displacement); |
| 851 | } |
| 852 | } |
| 853 | |
| 854 | const container: Container = new Container(); |
| 855 | container.bind<SparkPlugs>('SparkPlugs').to(SparkPlugs); |
nothing calls this directly
no outgoing calls
no test coverage detected