Alex Styl
06/12/2025, 6:13 AMstripe
package. do i need to create my own external interfaces(or use with dynamic) every time?Luv Kumar
06/13/2025, 7:53 PMsuspend fun foo(): String
should get converted to foo(): Promise<string>;
in Js. From what i know there is no native support for this. I was able to reach a Js signature fooAsync(): Promise<String>;
using kotlin-suspend-transform-compiler-plugin , but i would want to have the same signature(without async) as it would be easier for all 3 targets(android, ios and js) to follow the generated docs and use it.
Is there a way to achieve this ? other obv option is to have duplicate exported api interfaces for only js, but i really don't wish to go that route.
I was also thinking if this plugin or some other plugin could help me generate a synthetic function
@JsExport
@JsName("foo")
fun fooSynthetic(): Promise<String> // generated synthetic function
@JsName("_foo")
suspend fun foo(): String // original function defined in api
If somehow above could be achieved, i was thinking it could work ? (Please correct me if my thought process is wrong here, i am new to KMP)
Thanks.shikhar
06/15/2025, 3:33 AMRemy Benza
06/16/2025, 8:05 AMGenis Lin
06/16/2025, 1:14 PMEdoardo Luppi
06/16/2025, 6:47 PMtsgo
this might become even easier as it won't require a Node instance to be running.PHondogo
06/18/2025, 8:46 PMphteven
06/19/2025, 11:06 AMoutputFileName = “main.bundle-[contenthash].js”
Volodymyr Galandzij
06/19/2025, 6:25 PMHildebrandt Tobias
06/19/2025, 9:34 PMuseQuery<Array<DocumentationElementDto>?, Error, Array<DocumentationElementDto>, QueryKey>(
options = UseQueryOptions(
queryKey = DOCUMENTATION_QUERY_KEY.plus(subCategory),
queryFn = QueryFunction {
secureApi(DocumentationEndpoints
.getDocumentationElement
.copy(optionalQueryParams = pairListOf("category" to subCategory))
)},
refetchOnMount = { _ -> false },
refetchOnWindowFocus = { _ -> false },
refetchOnReconnect = { _ -> false },
refetchInterval = 0,
refetchIntervalInBackground = false,
)
)
In this case
refetchOnMount = { _ -> false },
refetchOnWindowFocus = { _ -> false },
refetchOnReconnect = { _ -> false },
doesn't work, but these two:
refetchInterval = 0,
refetchIntervalInBackground = false,
behave as expected.
I also tried useCallback { _ -> false }
, but it isn't accepted by the compiler.Martin Janči
06/22/2025, 2:38 PMHildebrandt Tobias
06/24/2025, 8:44 PM<http://vis.gl/react-google-maps|vis.gl/react-google-maps>
, but I also loaded googlemaps/js-api-loader
.
If you look at the Marker example there is:
new google.maps.Marker({
position: map.getCenter(),
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 10,
},
draggable: true,
map: map,
});
But I can't figure out how to aquire the predefined google.maps.SymbolPath.CIRCLE
constant? object?
Just providing the path as a string doesn't work it says unexpected g at position 0 (the g from google I guess).
I tried
@file:JsModule("@googlemaps/js-api-loader")
@file:JsNonModule
package shared.utils.maps
@JsName("CIRCLE")
external val CIRCLE: dynamic
But that also doesn't work.
I know I can provide my own SVG and PNG and such, but it kinda irks me, someone got an idea?
Edit: Okay I added the npm https://www.npmjs.com/package/google-maps and added:
@file:JsModule("google-maps")
@file:JsNonModule
package shared.utils.maps
@JsName("CIRCLE")
external val CIRCLE: dynamic
But it seems that CIRCLE
is null
when I access it.Hildebrandt Tobias
06/25/2025, 9:07 PM2025.6.11
and now I get
org.jetbrains.kotlin.util.FileAnalysisException: While analysing Authentication.kt:47:1: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalArgumentExceptionWithAttachments: Exception in declaration checker
Caused by: java.lang.IllegalStateException: Symbol for Any not found
For every top level object
declaration like
object Foo {
val bar: Bar
}
where there is no Any
?
EDIT Okay I cleaned and invalidated everything and it doesn't come up for now. I'll check back once the migration is fixed.
Edit2 I get the error with Kotlin 2.1.0, but not with 2.2.0, but migrating to 2.2.0 is much work now. sigh.CLOVIS
06/27/2025, 8:55 PMSargun Vohra
07/01/2025, 5:16 PMconst { PokeApi } = require('pokekotlin').co.pokeapi.pokekotlin
Is there any way to override that namespacing so JS users can use my library like:
const { PokeApi } = require('pokekotlin')
Or alternatively, is there a way to include some custom js and .d.ts in my Kotlin/JS library export? So I can define an index.js myself that re-exports my declarations from the root
My goal is to have a single KMP library with an idiomatic API for Kotlin, Java, JS/TS, and Swift/ObjC, but the package name being exposed to JS is awkward there. It’s more than just the import syntax; LSP tooling like automatic imports and stuff don’t work well when the importable declarations are buried under a package hierarchy.CLOVIS
07/05/2025, 5:27 PMjsBrowserDevelopmentRun
, I get:
• build/js/packages/example-simple/kotlin/example-simple.js
• build/js/packages/example-simple/kotlin/example-simple.js.map
The second one contains:
{
"version": 3,
"sources": [
"../../../../../src/jsMain/kotlin/Main.kt",
"../../../../compileSync/js/main/developmentExecutable/kotlin/src/kotlin/util/Standard.kt"
],
// …
The Main.kt
file refers to my own source code, fine.
However, I don't understand that Standard.kt
file. The build/compileSync/js/main/developmentExecutable/kotlin
folder does NOT contain a src/
folder, and there is no Standard.kt
file anywhere in the build/
directory.
What's going on here?Zyle Moore
07/06/2025, 12:45 AM> Task :web:jsBrowserProductionWebpack
asset web.js 221 KiB [emitted] [minimized] (name: main) 2 related assets
modules by path ../../node_modules/ 539 KiB
modules by path ../../node_modules/react-dom/ 512 KiB 4 modules
modules by path ../../node_modules/react/ 16.9 KiB
../../node_modules/react/index.js 186 bytes [built] [code generated]
../../node_modules/react/cjs/react.production.js 16.7 KiB [built] [code generated]
modules by path ../../node_modules/scheduler/ 10.1 KiB
../../node_modules/scheduler/index.js 194 bytes [built] [code generated]
../../node_modules/scheduler/cjs/scheduler.production.js 9.94 KiB [built] [code generated]
modules by path ./kotlin/*.js 158 KiB
./kotlin/prison-web.js 16.2 KiB [built] [code generated] [3 warnings]
./kotlin/kotlin-kotlin-stdlib.js 124 KiB [built] [code generated] [64 warnings]
./kotlin/kotlin-react.js 2.92 KiB [built] [code generated] [5 warnings]
./kotlin/kotlin-react-core.js 6.69 KiB [built] [code generated] [6 warnings]
./kotlin/prison-core.js 3.82 KiB [built] [code generated]
./kotlin/kotlin-react-dom.js 4.5 KiB [built] [code generated] [6 warnings]
webpack 5.94.0 compiled successfully in 4535 ms
Sargun Vohra
07/08/2025, 12:44 AMnpm(..)
entry in their gradle file?Marc
07/08/2025, 2:10 PM@JsExport
only works on classes that exclusively use non-suspending functions. Is there a way to transform the suspending functions into functions returning promises automatically? In case I need to do it manually I am also not quite sure how to do that, since I want to mostly keep the existing class but only transform a couple of suspending functions to promises.alexandre mommers
07/09/2025, 5:26 PMMateus Moreira
07/11/2025, 1:23 AMAbduqodir Qurbonzoda
07/11/2025, 9:38 AMNo matching export in "<kmp-library>.mjs" for import "KtList"
) when I switch to ES2015 target. The issue is also described in this ticket. Is there any workaround for it?Nathan Fallet
07/12/2025, 3:11 PMCLOVIS
07/12/2025, 6:30 PM> Task :kotlinNpmInstall FAILED
error <https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-4.2.2.tgz>: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, open '/usr/local/share/.cache/yarn/v6/npm-webpack-merge-4.2.2-a27c52ea783d1398afd2087f547d7b9d2f43634d-integrity/node_modules/webpack-merge/lib/join-arrays.js.map'"
across all my projects, across all CI runners, with different packages. Do we know what could cause this?
At the moment, it's hard to upgrade because all JS pipelines fail more than ~50% of the timeLucy
07/14/2025, 6:14 PMZyle Moore
07/15/2025, 5:33 AMjsBrowserDevelopmentRun
task usually works. I'm nowhere near max RAM on on my box though, this happens when usage is at < 30%. No noticeable increase in usage before or after.
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.base/java.util.ArrayList.iterator(ArrayList.java:1029)
at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$DeclarationTransformer.rewriteTypesInFunction(PartiallyLinkedIrTreePatcher.kt:1397)
at org.jetbrains.kotlin.backend.common.linkage.partial.PartiallyLinkedIrTreePatcher$DeclarationTransformer.visitSimpleFunction(PartiallyLinkedIrTreePatcher.kt:293)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:131)
at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:19)
at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:39)
at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:33)
at org.jetbrains.kotlin.ir.declarations.IrProperty.transformChildren(IrProperty.kt:55)
...
Hildebrandt Tobias
07/15/2025, 8:45 AMArray
through useQuery<Array<MyType>>()
and feed it into the TanStackTable directly everyting works, no problems.
But when I filter the Array
or convert it to a list for other reasons and then convert it back via .toTypedArray()
the TanStackTable displays the data correctly, but it refreshes infinitely and very fast lagging the tab.
I can see the constant getXXXModel()
log messages in the console.
previewDataQuery
.data
?.filter { it.active }
?.toTypedArray()
Someone got a suggestion how to fix this?
Edit: So the behaviour is essentially like this:
useReactTable(data = previewData) // OK
useReactTable(data = previewData.toList().toTypedArray()) // Infinite Loop
Edoardo Luppi
07/16/2025, 9:55 AMBigInt
adoption in place of a custom Long
implementation will be very useful for kotlinx-io, or for the UUID/hex stdlib utilities, as they make use of longs quite often.shikhar
07/16/2025, 4:03 PMany
type
solved it like below:
// common
expect class NativeLong
expect fun toNativeLong(value: Long): NativeLong
actual fun toKtLong(value: NativeLong): Long
// js
actual typealias NativeLong = BigInt
actual fun toNativeLong(value: Long) = (js("BigInt") as (dynamic) -> BigInt)(value.toString())
actual fun toKtLong(value: NativeLong) = value.toString().toLong() // throws if out-of-range
// ios/android
actual typealias NativeLong = Long
actual fun toNativeLong(value: Long): NativeLong = value
actual fun toKtLong(value: NativeLong): Long = value
And if it’s used in a @Serializable
class, we provide a custom serializer based on target platform
Now I can use it as:
data class UserId(id: NativeLong)
fun takeInput(value: NativeLong)
And its easily usable for js devs
// generated .d.ts
export declare class UserId {
constructor(id: BigInt);
get id(): BigInt;
copy(id?: BigInt): UserId;
toString(): string;
hashCode(): number;
equals(other: Nullable<any>): boolean;
}
export declare function takeInput(num: BigInt): void;
The primary downside here is overhead of toKtLong()
in js, which decodes->encodes the value on every call.
Solvable using a “holder” type for native values, which has a lazy prop that holds the kotlin long value.
For folks who have tackled this, please suggest your methods and any issues you see with above. (like if using typealiasing like this has any risks for exported types etc)Edoardo Luppi
07/17/2025, 2:47 PM