Open danielriverolosa opened 3 years ago
Hello,
I am getting an error when trying to make @Injectable a class that inherits an abstract class that has generic parameters.
This is the class injectable:
@Injectable(scope = Scope.BY_USE) class GetContactListUseCase(private val repository: ContactRepository): UseCase<Contact, Filter>() { override suspend fun run(params: Filter): User { return repository.getContactList(params) } }
abstract class UseCase<Type, in Params> where Type: Any { protected abstract suspend fun run(params: Params): Type suspend operator fun invoke(params: Params): Result<Type> { return withContext(ioDispatcher) { try { successOf(run(params)) } catch (e: Exception) { failureOf(RuntimeException("Use case error => ${e.message}")) } } } }
And this is the error I am getting when I try to compile.
2 type arguments expected for class UseCase<Type : Any, in Params>
Hello,
I am getting an error when trying to make @Injectable a class that inherits an abstract class that has generic parameters.
This is the class injectable:
And this is the error I am getting when I try to compile.
2 type arguments expected for class UseCase<Type : Any, in Params>