https://kotlinlang.org logo
#getting-started
Title
# getting-started
h

hfhbd

11/16/2023, 10:24 AM
Is it expected I need to pass the optin marker for all usage when I use OptIn for an actual platform implementation with Kotlin 1.9.20:
Copy code
// common
expect interface Closeable {
  fun close()
}
// target, here wasmMain
@OptIn(ExperimentalStdlibApi::class)
public actual typealias Closeable = kotlin.AutoCloseable
When I use this interface in common,
class Foo: Closeable
, I get this error:
This declaration needs opt-in
.
h

hho

11/16/2023, 1:36 PM
Yes, that's expected (see the docs). You can pass the opt-in as a compiler argument to enable it for all your code at once.
2 Views