I want to declare a singleton of a particular type...
# koin
d
I want to declare a singleton of a particular type, which is generic. I only need to produce an instance for one particular value of that generic type (which is convenient since I don't believe Koin lets me differentiate on that anyway). So I can do
Copy code
single {
  GraphQLServer<ApplicationRequest>(get(), get(), get())
}
But I do like the constructor DSL. Is it possible to do this with
singleOf
?
singleOf(::GraphQLServer)
says it doesn't have enough information to infer a type, and
singleOf(::GraphQLServer<ApplicationRequest>)
isn't even valid syntax.
a
did you tried
singleOf<GraphQLServer<ApplicationRequest>>(::GraphQLServer)
?
I'm afraid it won't have enough generic info else 🤔
d
I thought I did and it didn't work, though I can try again. (Just using
single
has been working fine
gives an enormous screen-filling error
a
yeah sure