Учитывая некоторый интерфейс:
interface IFoo {
userService: IUserService
authService: IAuthService
}
Как получить IUserService
и IAuthService
с помощью следующей функции:
function getInternalTypes<T>() {
// Need to loop through T (somehow) and extract those types, for example to do something like:
// IoCContainer.Resolve<K>(KString); // where K is the type IUserService and KString is the string "IUserService".
}
Я знаю, что вы можете использовать keyof
для получить ключи, но не уверен, как я могу go получить фактические типы для этих ключей (typeof
? Я не знаю ...)