Is it/will it be possible to have `external value ...
# javascript
j
Is it/will it be possible to have
external value class Whatever(whatever: String)
?
a
I think it is kind of dificult, coz the kotlin compiler won't know how to inline external declarations. What are you trying to achieve? What is your usecase?
j
I wish to pass ids to a props object
like:
Copy code
external interface SomeProps: RProps {
    var someId: SomeId
}
Where someId is:
Copy code
data class SomeId(val uuid: UUID)
it would be perfect to transform this
SomeId
to a value class, but with inline classes this was not possible
so I wonder, did anything change with value classes or not
a
why is
Copy code
external interface SomeProps: RProps {
    var someId: UUID
}
not working for you?
j
that would work, but I would love to have type safety
Because I can pass different types of ids to the same props
I first used UUIDs which led to bugs and I refactored to wrap the uuid so they are strongly typed
a very good use case for value classes
but doesn't work with external classes/interfaces
a
I still believe you can achieve type safety without using value classes
j
yeah I use data classes
but the value classes are more optimized
a
I get your point know
does the compiler throw an error when you change SomeId into a value class?
not external value class, just a value class
j
I did not try it out to be honest 🙂 Maybe over the weekend I create a test project with kotlin 1.5 to see what happens