https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
javascript
  • d

    Derek Wong

    06/17/2022, 4:49 AM
    Are .d.ts Typescript files generating with kotlin 1.7.0 for anyone? Not sure if i have a config issue in my project or I should report an issue
    a
    • 2
    • 2
  • a

    Adam S

    06/18/2022, 7:57 PM
    hi, I've set up a websocket devserver in my
    build.gradle.kts
    file but I'm getting an error in the application logs
    <i> [webpack-dev-server] [HPM] Upgrading to WebSocket
    <e> [webpack-dev-server] [HPM] WebSocket error: Error: read ECONNRESET
    <e>     at TCP.onStreamRead (node:internal/stream_base_commons:220:20) {
    <e>   errno: -4077,
    <e>   code: 'ECONNRESET',
    <e>   syscall: 'read'
    <e> }
    If I hardcode the websocket server URL to
    <ws://localhost:8080/ws>
    of course it works - but I don't want to hard code it. I couldn't find any examples or documentation on this. Has anyone managed to set up websockets with Kotlin/JS? What's the best practice? I'm using Kotlin/JS 1.7.0 and KVision 5.10.1. More details in #kvision here and on StackOverflow here
    • 1
    • 1
  • r

    Robert Jaros

    06/21/2022, 12:38 PM
    Btw. congratulations to the Kotlin/JS team on bundle size reduction in Kotlin 1.7.0. It's really impressive (up to 30% in my tests compared to 1.6.21)! 🙂
    ❤️ 7
    :tnx: 2
    :kotlin-intensifies: 20
  • j

    janvladimirmostert

    06/21/2022, 7:58 PM
    What is the correct type to use in Kotlin in order to get an exported type as {} in JavaScript? I've tried Map, but IJ is complaining "Exported declaration uses non-exportable parameter type: Map<String, String>" Instead of List, I have to use Array to get [] in JavaScript / TypeScript, what type will give me a JavaScript object, {}
    e
    b
    g
    • 4
    • 8
  • d

    Danilo Reinert

    06/21/2022, 8:59 PM
    Are you a KotlinJS enthusiastic and would like to integrate a multiplatform open source project to make the KotlinJS ecosystem even better? I'm sharing the new v1.1 release of the requestor library, an HTTP Client API that unlocks the development of communication-centric frontend apps - a sustainable software design for micro clients. The lib’s core is written in vanilla Java with functional programming as a first class citizen, and it's designed to be compatible with any underlying platform, like jvm or the browser. Currently, there are two requestor impls: requestor-javanet for Jvm/Android and requestor-gwt for gwt2. Now we're looking to provide a new impl for KotlinJS: requestor-kotlinjs. The path to get there is really simple and already planned. If you're a kotlinjs developer and would like to learn and contribute to the ecosystem with a modern library for HTTP communication, check out the project at https://github.com/reinert/requestor and get in touch with me here or at the project’s chat room to know how to contribute.
    👏 1
    o
    s
    • 3
    • 6
  • s

    spierce7

    06/23/2022, 1:49 PM
    I’m trying kotlin-js again for the first time in a while. I have a simple module with some JS code compiling using the new IR compiler. What’s the easiest way for me to provide a separate isolated piece of js code for a team to use in a browser?
    b
    • 2
    • 13
  • s

    spierce7

    06/23/2022, 4:29 PM
    I’m compiling with the IR compiler but not seeing
    d.ts
    files generated. https://kotlinlang.org/docs/js-ir-compiler.html#preview-generation-of-typescript-declaration-files-d-ts Is there something I have to do to enable this?
    b
    • 2
    • 1
  • s

    salomonbrys

    06/23/2022, 4:33 PM
    Hey guys, I'm trying to understand something in the Kotlin-React code (for my comprehension), and I'm kind of getting mad here, please help me understand this fracking magic!!! So, in
    ChildrenBuilder
    (https://github.com/JetBrains/kotlin-wrappers/blob/master/kotlin-react/src/main/kotlin/react/ChildrenBuilder.kt), the
    ElementType<P>.invoke
    function declares the generic bounds
    where P : Props, P : ChildrenBuilder
    . I can call this function inside a
    ChildrenBuilder
    with, for example,
    ReactHTML.div.invoke {}
    (here I put the
    invoke
    to be explicit, even though it is not required). Now,
    ReactHTML.div
    is an
    IntrinsicType<HTMLAttributes<HTMLDivElement>>
    , which is also an
    ElementType<HTMLAttributes<HTMLDivElement>>
    , so the resolution kind of makes sense... BUT I cannot find anywhere
    HTMLAttributes
    implements
    ChildrenBuilder
    , which should break the resolution of the
    ElementType<P>.invoke
    function. The
    HTMLAttributes
    interface implements
    AriaAttributes
    ,
    DOMAttributes
    ,
    PropsWithRef
    ,
    PropsWithChildren
    ,
    PropsWithClassName
    ,
    PropsWithStyle
    , and
    Props
    . How the hell can the Kotlin Compiler agrees that the
    where
    clause of the
    ElementType<P>.invoke
    function is satisfied ?!?!? Furthermore, IntelliJ shows the
    invoke
    "this" hint as
    ChildrenBuilder & HTMLAttributes<HTMLDivElement> & Props
    , when, according to the
    invoke
    function signature, it should simply display
    HTMLAttributes<HTMLDivElement>
    . Where is the
    ChildrenBuilder
    coming from ? What black magic is that ?!? Oh, and when I ask IntelliJ to explicit the type argument to
    invoke
    , it can't! It puts
    Any
    , which clearly breaks the
    where
    clause. If I try to set myself the type argument with
    div.invoke<HTMLAttributes<HTMLDivElement>>
    , then IntelliJ tells me that "Type argument is not within its bounds", which I fully agree with! Help me, please, I'm losing it 🙃 !
    😜 1
    s
    • 2
    • 26
  • m

    Moritz Hofmeister

    06/24/2022, 7:17 AM
    Incremental compilation for the IR compiler is still not working, right? @turansky (Was already discussed 10 days ago here)
    r
    • 2
    • 1
  • b

    Big Chungus

    06/24/2022, 1:14 PM
    Another QoL PR for KGP/JS - #4881
  • s

    spierce7

    06/26/2022, 10:46 PM
    I’m not able to check the variable values while debugging Kotlin code in Chrome. I thought I used to be able to do this. I’m using IR. Is there a way to improve it? I’m using Kotlin 1.6.21. It’s not a good experience right now.
  • a

    Arkadii Ivanov

    06/27/2022, 9:08 AM
    I have a devtools Chrome extensions written in Kotlin, the UI is implemented with Compose for Web. The project is distributed as
    browser()
    +
    binaries.library()
    and everything works fine. Now I'm trying to replace Compose with React (
    org.jetbrains.kotlin-wrappers:kotlin-react-dom
    ), and I'm getting the following runtime error:
    Uncaught Error: Error loading module 'xyz'. Its dependency 'react-dom/client' was not found. Please, check whether 'react-dom/client' is loaded prior to 'xyz'.
    If I use
    binaries.executable()
    then there is another runtime error:
    Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'"
    Is there a way to distribute a Chrome extension with React dependencies?
    b
    t
    i
    • 4
    • 80
  • a

    Alexander Sysoev

    06/27/2022, 11:28 AM
    Hello everyone! Say where is a class defined in
    .js
    file like this:
    OuterClass.InnerClass = function(arg1, arg2) { ... } 
    
    export default p5.Element;
    How can i write external declaration for it in kotlin, given that i already have OuterClass exported? Should it be like
    external class OuterClass {
        class InnerClass(arg1: Int, arg2: Int) {}
    }
    Can it be done outside
    OuterClass
    class?
    b
    • 2
    • 3
  • m

    mbonnin

    06/28/2022, 10:47 AM
    We have a build matrix that compiles our project for both Kotlin 1.6 and Kotlin 1.7. Depending the Kotlin version, I get different npm dependencies in
    kotlin-js-store
    and
    kotlinNpmInstall
    . Is it possible to tell Kotlin 1.6 to use the 1.7 npm dependencies? Looks like no matter what I do, these dependencies are overwritten
    ✅ 1
    h
    v
    t
    • 4
    • 7
  • a

    andylamax

    06/28/2022, 1:26 PM
    Hello, I am getting
    Please make sure that you have installed browsers.
    Or change it via
    browser {
        testTask {
            useKarma {
                useFirefox()
                useChrome()
                useSafari()
            }
        }
    }
    when running in IDE. But the tests are running fine when I run them in the terminal. Is this a known problem? I have a CHROME_BIN environment variable in my machine
    b
    • 2
    • 6
  • a

    Arkadii Ivanov

    06/28/2022, 9:55 PM
    When distributing a
    library
    that depends on e.g.
    org.jetbrains.kotlin-wrappers:kotlin-react-dom
    , is there are way to automatically populate transitive NPM dependencies in
    package.json
    ? So that I can avoid adding
    implementation(npm("react-dom", "*"))
    explicitly.
    b
    a
    i
    • 4
    • 12
  • a

    Ayfri

    06/29/2022, 8:43 PM
    Hi, since 1.7.0, my tests can't find my dependencies, I'm using only
    org.jetbrains.kotlin-wrappers:kotlin-js
    and
    io.github.turansky.seskar:seskar-core:
    , Idea is completely fine with it, but when I run tests, it can't find anything from these, my dependencies are set like this
    api("io.github.turansky.seskar:seskar-core:${Versions.seskar}")
    api("org.jetbrains.kotlin-wrappers:kotlin-js:${Versions.kotlinWrappers}")
    testImplementation(kotlin("test-js", Versions.kotlin))
    And
    Versions
    is an object with
    const val
    string properties defining the versions and is defined in my
    buildSrc
    module.
    t
    a
    r
    • 4
    • 8
  • m

    Matthias Geisler

    06/30/2022, 5:07 PM
    Hey did somebody had luck to integrate KotlinJs with WASM?
    b
    • 2
    • 9
  • c

    Chukwukammadu Anizoba

    06/30/2022, 9:14 PM
    Hey guys, I've been having issues building by KotlinJS project with the following error:
    error An unexpected error occurred: "<https://registry.yarnpkg.com/@types/eslint/-/eslint-8.4.4.tgz>: Request failed \"404 Not Found\"".
    
    > Task :kotlinNpmInstall FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':kotlinNpmInstall'.
    >                 Process 'Resolving NPM dependencies using yarn' returns 1
    
                      yarn install v1.22.10
      info No lockfile found.
      [1/4] Resolving packages...
      [2/4] Fetching packages...
    Was able to run the project fine an hour ago. Any idea what could be causing this?
    v
    a
    • 3
    • 3
  • a

    alexcouch

    06/30/2022, 10:45 PM
    hi, I am using Compose for Web and was wondering if there was a way to set an auto for margin. I tried looking around and could not find any examples. I am new to web so maybe I am missing something?
  • b

    Bernhard

    06/30/2022, 11:05 PM
    how does kotlinjs interact with existing typescript definitions?
    d
    h
    • 3
    • 3
  • r

    Renegade Master

    06/30/2022, 11:57 PM
    Is there a recommended way to read files from a project's Resources folder in Kotlin JS?
    b
    c
    • 3
    • 6
  • x

    xiaobailong24

    07/01/2022, 11:17 AM
    Hello, I am using kotlin Multiplatform Mobile in Android and iOS application, but new for kotlin js. Is it possible that kotlin js works with react native in mobile application perfectly? And is there some demo for this?
  • e

    Erik

    07/01/2022, 2:16 PM
    Is it possible to debug the Kotlin code of my web app from IntelliJ, by using breakpoints? Or if another way is recommended, please tell me where to start. (Maybe this is a question for #compose-web because it's a compose for web project?)
    o
    • 2
    • 3
  • r

    ribesg

    07/01/2022, 3:06 PM
    I’m trying to understand how I’m supposed to setup my build file. If I want to make a browser app in Kotlin/JS, I need to use
    browser {}
    . If I want to write a NodeJS server in Kotlin/JS, I use
    nodejs {}
    . But what do you use for “pure” libraries? What if I want to remake something like Moment.js from scratch? Or a simple algorithm implementation? It can be used both in the browser or in a nodejs server, it’s “just pure js”. How do you configure a project like that? Do you target one or the other, or both? Does it make a difference?
    e
    • 2
    • 3
  • j

    Javier

    07/02/2022, 8:32 PM
    Has anyone seen this issue?
    > Task :library:compileTestKotlinJsIr FAILED
    e: java.lang.StackOverflowError
            at java.base/sun.nio.fs.WindowsNativeDispatcher.FindFirstFile(WindowsNativeDispatcher.java:195)
            at java.base/sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
            at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:535)
            at java.base/java.nio.file.Files.newDirectoryStream(Files.java:482)
            at org.jetbrains.kotlin.konan.file.File.getListFiles(File.kt:56)
            at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl$packageMetadataParts$1.invoke(KotlinLibraryImpl.kt:75)
            at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl$packageMetadataParts$1.invoke(KotlinLibraryImpl.kt:72)
            at org.jetbrains.kotlin.library.impl.BaseLibraryAccess.inPlace(KotlinLibraryLayoutImpl.kt:71)
            at org.jetbrains.kotlin.library.impl.MetadataLibraryImpl.packageMetadataParts(KotlinLibraryImpl.kt:72)
            at org.jetbrains.kotlin.library.impl.KotlinLibraryImpl.packageMetadataParts(KotlinLibraryImpl.kt)
            at org.jetbrains.kotlin.backend.common.serialization.metadata.impl.KlibMetadataDeserializedPackageFragmentsFactoryImpl.createDeserializedPackageFragments(KlibMetadataDeserializedPackageFragmentsFactoryImpl.kt:33)
            at org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl.createPackageFragmentProvider(KlibMetadataModuleDescriptorFactoryImpl.kt:115)
            at org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl.createDescriptorOptionalBuiltIns(KlibMetadataModuleDescriptorFactoryImpl.kt:72)
            at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.getModuleDescriptor(klib.kt:728)
            at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.getModuleDescriptor(klib.kt:738)
    • 1
    • 1
  • r

    Reuben F

    07/04/2022, 6:33 PM
    Hello, I wrapped html2pdf; the basic function works, but I haven't figured out a way to get it to accept its options dictionary. Anybody have a few minutes to try it out?
    b
    • 2
    • 11
  • y

    Yakeen Sewsanker

    07/05/2022, 1:24 PM
    Hi there! I'm using Kotlin/JS to build a library and wanted to know why .d.ts are not being generated as per the docs (btw I'm using
    binary.library()
    instead of
    binary.executable()
    )?
    • 1
    • 1
  • a

    Ayfri

    07/05/2022, 4:29 PM
    Hi, is it useful in any means to not ignore
    yarn.lock
    on GitHub ?
    g
    v
    • 3
    • 2
  • g

    gbaldeck

    07/05/2022, 8:40 PM
    Is there a way I can use Jest for my tests instead of Mocha or Karma?
    b
    • 2
    • 1
Powered by Linen
Title
g

gbaldeck

07/05/2022, 8:40 PM
Is there a way I can use Jest for my tests instead of Mocha or Karma?
b

Big Chungus

07/06/2022, 1:49 AM
I'm pretty sure it's possible with a colossal amount of tinkering, but it's not supported in any official capacity.
View count: 2