Generics in TypeScript are only in compile-type and all information about your generics types are removed in output javascript code. Thats why its not possible to do what you want. Its only possible if you explicitly specify a type to your generic repository, for example via constructor: