Hello, I use `expect/actual` as follows: ```//comm...
# multiplatform
a
Hello, I use
expect/actual
as follows:
Copy code
//common
expect class PlatformElement

//android
//works
actual typealias PlatformElement = View 

//js
//error:The following declaration is incompatible because modality is different
actual typealias PlatformElement = HTMLElement
I found HTMLElement is
abstract
, so it fails. But I won't use the constrcutor, I just want to declare the type, so what should I do ?
j
as long as you don't expose a constructor in common you can suppress the error and it'll be fine. another option is to use a value class on JS to "wrap" HTMLElement
a
It works, thank you!
l
Hi @jw @Ayla i am also facing a similar issue in
Copy code
// commonMain
expect class PlatformStream

// iosMain
actual typealias PlatformStream = NSInputStream

// androidMain
actual typealias PlatformStream = InputStream
could you guys share how can i suppress it ? i tried something like
Copy code
@Suppress("ACTUAL_WITHOUT_EXPECT")
actual typealias PlatformReadStream = InputStream
doing above idea removes the compilation warning but doing
./gradlew build -x check
still give following error `Expect declaration
PlatformReadStream
is incompatible with actual
PlatformReadStream
because modality is different. Expect declaration modality is 'final'. Actual declaration modality is 'abstract'`