Bernhard
04/11/2025, 4:30 PMpackage com.i18next
import com.handlebarsjs.Handlebars
@JsModule("handlebars-i18next")
@JsNonModule
external fun registerI18nHelper(
handlebars: Handlebars,
i18Next: I18Next,
helperName: String? = definedExternally
)
but that produces handlebars_i18next__WEBPACK_IMPORTED_MODULE_12__ is not a function with or without the @JsNonModule annotationJilles van Gurp
04/14/2025, 5:30 PMDirk
04/15/2025, 7:08 AMExecution failed for task ':gui:jsProductionGenerateLazyModules'.
> Could not copy file 'C:\projektdateien\avh\portalng\client\gui\build\compileSync\js\main\productionExecutable\kotlin\portalng-vorabanfrageGui\seiten\Vorabanfrage__lazy__module.mjs' to 'C:\projektdateien\avh\portalng\client\gui\build\tmp\jsProductionGenerateLazyModules\portalng-vorabanfrageGui\seiten\Vorabanfrage__lazy__module.mjs'.
> Error - Invalid filter specification for seskar.gradle.plugin.LazyModuleReader
Besides the plugin, target = "es2015" is set and in the gradle.properties kotlin.js.ir.output.granularity=per-file.
Did I forget to configure something?Edoardo Luppi
04/15/2025, 2:19 PMString
type, instead of sharing them with CharSequence
, so instead of calling charSequenceGet(str, index)
it will call charCodeAt(str, index)
directly.
Apart from that I see there are fixes for plain objects support, and finally exporting Promise<Unit>
won't output a warning anymore https://youtrack.jetbrains.com/issue/KT-57192.robstoll
04/17/2025, 6:51 AMdescribe("foo") {
context("bar") {
it("should add numbers correctly") {
assertEquals(4, 2 + 2)
}
}
}
external fun describe(name: String, block: () -> Unit)
external fun context(name: String, block: () -> Unit)
external fun it(name: String, block: () -> Unit)
Works in gradle but intellij does not pick it up correctly, i.e. not all tests are shown in the test view (it is picked up correctly in the build view though)Bernhard
04/19/2025, 8:49 AMRobert Jaros
04/21/2025, 2:56 PMKotlinWebpack
task (via gradle plugin). I'm testing Kotlin 2.2.0-Beta1
and it doesn't work anymore.Bernhard
04/22/2025, 10:42 AMHildebrandt Tobias
04/22/2025, 1:45 PMval submitHandler = useMutation<CompanyDto?, Error, String, Unit>(
options = UseMutationOptions(
mutationFn = {
secureApi(CompanyEndpoints.putCompany.copy(
bodySerializerType = typeOf<CompanyDto>(),
body = editedCompany
))
},
onSuccess = { _, _, _ ->
queryClient.invalidateQueries(
InvalidateQueryFilters<Any,Any,Any, QueryKey>(
queryKey = ADMIN_QUERY_KEY
)
)
}
)
)
I kind of hoped the types of InvalidateQueryFilters
were inferable from useMutation<...>
.
Or am I using it wrong? (Trying to follow this: https://tanstack.com/query/latest/docs/framework/react/examples/auto-refetching?panel=sandbox)Remy Benza
04/23/2025, 9:30 AMMárton Matusek
04/24/2025, 12:18 PMErik van Velzen
04/25/2025, 3:42 PMimport js.import.import
suspend fun MyFun(cloudUrl: String) {
import<Unit>(
/* webpackIgnore: true */
"$cloudUrl/assets/js-client-8.5.0/cloud-client.js"
)
}
Unfortunately the magic comment is removed when compiling Kotlin to JS.
In the browser i get the error "Cannot find module 'https://anylogic.zenmo.com/assets/js-client-8.5.0/cloud-client.js'".
import("<https://anylogic.zenmo.com/assets/js-client-8.5.0/cloud-client.js>")
works in plain javascript. How do I get the compiler/webpack to leave this import untouched?Robert Jaros
04/26/2025, 11:34 AMPHondogo
04/28/2025, 7:09 PMe: java.lang.IllegalStateException: IC internal error: can not find library org.jetbrains.compose.material:material-icons-core
If add dependency of that library everything compiles fine.
Other targets or Js target but production build compiles fine without this dependency.
Is it known issue?Hildebrandt Tobias
04/29/2025, 12:10 PMReadOnlyArray<T>
but they have a little wrapper like ColumnFiltersTableState
which only has 1 field var columnFilters: ReadonlyArray<ColumnFilter>
.
I want to save the user's settings like sorting, filters, etc. to localStorage
.
The thing is, since ColumnFiltersTableState
is an external interface I cannot reify it for deserialization.
And I cannot just use ReadonlyArray<ColumnFilter>
directly since it doesn't get explicitly exposed by TanStack,
so I get ReferenceError: ColumnFilter is not defined
when I try it like this.
I also can't JSON.Stringify
since that would create problems in other places, it sometimes adds _1
to fields.Erik van Velzen
04/30/2025, 9:02 AMHildebrandt Tobias
04/30/2025, 9:06 AMUpdater
which is defined like this:
sealed external interface Updater<T> /* T | ((old: T) -> T) */
inline fun <T> Updater(
source: T,
): Updater<T> =
unsafeSpecialCast(source)
inline fun <T> Updater(
noinline source: (old: T) -> T,
): Updater<T> =
unsafeSpecialCast(source)
I know I can create these using functionalUpdate()
but how do I consume them?
Currently I do
this.onSortingChange = { newSorting ->
setSorting(newSorting.unsafeCast<SortingState>())
}
but it feels kind of wrong.
What is correct way to consume such an Updater
?Edoardo Luppi
05/01/2025, 4:08 PMEdoardo Luppi
05/05/2025, 9:34 AMobject
(only pure functions, no properties), the object is instantiated eagerly thanks to an optimization (which is good for perf!).
However, if that stateless object is used by an @EagerInitialization
-ed property, there will be a runtime error, as the property is initialized before the optimized object
.Umesh Solanki
05/06/2025, 12:35 PMsubmitFormWithBinaryData
I'm using HttpClient(Js)? formData.append didn't work.Edoardo Luppi
05/06/2025, 3:20 PMCLOVIS
05/06/2025, 3:59 PM@JsExport
@Serializable
data class Foo(
val bar: List<String>
)
is not exportable because List
is not exportable.
@JsExport
@Serializable
data class Foo(
val bar: Array<String>
)
doesn't work, because array equality is identity-based and not content-based.
@JsExport
@Serializable
class Foo(
val bar: Array<String>
) {
override fun equals(…) = …
override fun hashCode() = …
}
works, but it's a shame to have to generate equals
and hashCode
on all objects when one of the big advantages of Kotlin is not having to do this, especially for DTOs.
@JsExport
@Serializable
class MyCustomArray<T>(
val data: Array<T>
) { … }
@JsExport
@Serializable
class Foo(
val bar: MyCustomArray<T>,
)
doesn't work because KotlinX.Serializable can't serialize generic arrays.
@JsExport
@Serializable
class MyCustomList<T> private constructor(
internal val data: List<T>
) {
val elements: Array<T>
get() = ⚠
}
@JsExport
@Serializable
class Foo(
val bar: MyCustomList<T>
)
doesn't work because we can't convert a generic list into a generic array.
I'm curious, how do people share DTOs with JS? I see that the other solution is creating a dedicated JS shim, but the entire point of sharing code is to avoid duplication.Edoardo Luppi
05/06/2025, 4:18 PMEugen Martynov
05/06/2025, 7:03 PMName contains illegal chars that can't appear in JavaScript identifier
?Edoardo Luppi
05/06/2025, 7:42 PMnpm-publish
plugin.Edoardo Luppi
05/07/2025, 1:46 PMEdoardo Luppi
05/07/2025, 2:33 PMdebugger;
statement works.Arjan van Wieringen
05/08/2025, 8:51 AMHigor Oliveira
05/08/2025, 5:52 PMArtem Kobzar
05/08/2025, 7:00 PM