di.js icon indicating copy to clipboard operation
di.js copied to clipboard

Confused about the way injected values are resolved when they share common type

Open g00fy- opened this issue 11 years ago • 0 comments

class Database{
}

class MySql extends Database {}
class PostgreSql extends Database {}

@Inject(Database,Database)
class DatabaseSyncService {
    constructor(sourceDatabase: Database, destinationDatabase: Database){}
}

function main(){
    var injector = new Injector([PostgreSql,MySql]);
    var syncService = injector.get(DatabaseSyncService);
}

What will be provided to the syncService instance?

g00fy- avatar Oct 24 '14 07:10 g00fy-