type Factory = Function ; export class Repository { private readonly _repository : { [ key ] : Factory ; } ; private constructor ( ) { this . _repository = { } ; } private static _instance : Repository ; public static get instance ( ) : Repository { this . _instance = this . _instance || new Repository ( ) ; return this . _instance ; } public registerFactory ( key , factory ) { this . _repository [ key ] = factory ; } public getFactory ( key ) { return this . _repository [ key ] ; } }