I'm trying to initiate the RoomAlarmRepository inside the RepoInit 1 & 2.
The first one says "Type mismatch", and wouldn't let me compile. That is, unless I cast it like in RepoInit2, at which point it tells me that the cast is unchecked.
class RepoInit1(app: App) {
internal val repo: AlarmRepository<AlarmModel> = RoomAlarmRepository(app.database)
}
class RepoInit2(app: App) {
internal val repo: AlarmRepository<AlarmModel> = RoomAlarmRepository(app.database) as AlarmRepository<AlarmModel>
}
class RoomAlarmRepository(val database: AppDatabase) : AlarmRepository<RoomAlarmModel> {
}
class RoomAlarmModel : AlarmModel {
}
I'm currently using the second one, as it actually works. I know I'm missing something where I declare the variable, but I'm not sure what it is.

