diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt index e3fb6f260e..c75e32660e 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryShareParams.kt @@ -1,5 +1,7 @@ package dev.inmo.tgbotapi.webapps.stories +import kotlin.js.json + external interface StoryShareParams { val text: String @JsName("widget_link") @@ -10,8 +12,8 @@ fun StoryShareParams( text: String, widgetLink: StoryWidgetLink? ): StoryShareParams { - val result: dynamic = js("{}") - result["text"] = text - widgetLink ?.let { result["widget_link"] = it } - return result.unsafeCast() + val json = json() + json["text"] = text + widgetLink ?.let { json["widget_link"] = it } + return json.unsafeCast() } diff --git a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt index 61ee95a034..b56959cbd6 100644 --- a/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt +++ b/tgbotapi.webapps/src/jsMain/kotlin/dev/inmo/tgbotapi/webapps/stories/StoryWidgetLink.kt @@ -11,8 +11,8 @@ fun StoryWidgetLink( url: String, name: String? ): StoryWidgetLink { - val result: dynamic = js("{}") - result["url"] = url - name ?.let { result["name"] = it } - return result.unsafeCast() + val json = json() + json["url"] = url + name ?.let { json["name"] = it } + return json.unsafeCast() }