JetBrains has released Kotlin 2.4.20-Beta2, an update to the company’s multiplatform programming language that has emerged with capabilities ranging from the Wasmtime runtime to JavaScript functions and Swift accommodations.

Kotlin 2.4.20-Beta2 was released July 2. Among the new capabilities and improvements, the new release changes how Kotlin/Wasm handles top-level require() calls in @JsFun declarations, aligns companion object initialization order with JVM behavior, and supports Wasmtime as a runtime for thewasmWasi target in the Kotlin Gradle plugin. Kotlin/Wasm now initializes superclass companion objects before subclass companion objects, matching the JVM behavior. Previously, the initialization could be reversed, leading to inconsistent behavior across platforms.

Kotlin 2.4.20-Beta2 also introduces cross-language inheritance support to Swift export. A common use case for this feature is the reverse import pattern, where developers define a contract in Kotlin and provide platform-specific implementations on the Swift side. And for Kotlin/JS, Kotlin 2.4.20-Beta2 introduces an experimental DSL for browser testing and support for exporting suspend lambdas as JavaScript async functions. Previously, there was no way to export declarations containing suspend lambdas from Kotlin/JS libraries. Now, the Kotlin compiler automatically handles the bridging between Kotlin’s suspend functions and native JavaScript’s async/await model. This is useful for mixed Kotlin/TypeScript codebases, JetBrains said.