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

    Dalinar

    06/20/2017, 9:04 AM
    at this location in this kotlin javascript tutorial he is typing
    src=
    and magically gets an
    out
    folder to choose, how do I configure my kotlin javascript module to do that? (my out is located on another drive, I "Inherit project compile output path" in the module) I can't figure out the correct path to use in my
    src=
    for my code to run (I get 404 not found errors in the browser)

    https://youtu.be/rRC5m1U5snM?t=154▾

    Do you think that intellij web server requires out to be in the same folder as the src folder?
    k
    n
    • 3
    • 10
  • j

    jasper

    06/21/2017, 3:14 AM
    Kotlin Javascript used in prod anywhere yet?
    j
    • 2
    • 1
  • s

    sdeleuze

    06/22/2017, 8:50 PM
    It seems
    .klib
    is specifc to native so I guess it is not usable for Javascript ...
    k
    g
    +2
    • 5
    • 28
  • b

    bulwinkel

    06/23/2017, 2:47 AM
    anyone had any luck with kotlin and react native yet?
    k
    • 2
    • 6
  • d

    Dalinar

    06/23/2017, 7:15 AM
    1. do the same rules apply to kotlin js debugging as js debugging? in that I should use a different profile or browser for debugging? (so that other extensions can't interfere) 2. is there a way to attach from IDEA to javascript compiled from kotlin running in a chrome extension? I guess probably not but thought it wouldn't hurt to ask
    k
    • 2
    • 5
  • p

    pmiklos

    06/24/2017, 4:33 AM
    Oh, interesting. Awesome thank you!
    b
    • 2
    • 2
  • c

    clockworkant

    06/24/2017, 9:18 PM
    Is it feasible to learn Kotlin instead of javascript or do I really need to learn both. I'm coming from a background of 8 years of android/java with some html/css/php on occasion.
    d
    j
    • 3
    • 3
  • d

    Dalinar

    06/25/2017, 6:30 AM
    I would hate to do any kotlin JS or javascript programming without JQuery, so learn how to call that. I'm still trying to figure out the best way to do that myself, currently I just use the interop but would be nice to eventually get some kind of static typing for it somehow
    k
    n
    • 3
    • 10
  • n

    noctarius

    06/26/2017, 7:24 AM
    Does the kotlinjs compiler understand type definitions for typescript? 🙂
    k
    • 2
    • 3
  • a

    anton.bannykh

    06/26/2017, 2:37 PM
    @natpryce AFAIK spek is JVM-only. You could use kotlin-test library (https://github.com/JetBrains/kotlin/blob/master/libraries/kotlin.test/Module.md). With it you write your tests like so: https://github.com/JetBrains/kotlin/blob/master/libraries/kotlin.test/common/src/test/kotlin/kotlin/test/tests/BasicAssertionsTest.kt . You should be able to run such tests on JVM with JUnit and with QUnit on JS.
    n
    • 2
    • 2
  • d

    Dalinar

    06/26/2017, 6:31 PM
    Has anyone come across issues with interfaces? I have several (3) in my code. Everything was working fine.. then today for some reason I got a runtime error (even going back to old commits didn't help)... 'Uncaught TypeError: this.navigateToNextPage_6m5k6r$ is not a function` - all I could figure out how to do was to remove the interface, moving the functions directly into the class and making them abstract. My other 2 interfaces are still working fine on the same class
    k
    • 2
    • 6
  • d

    damirb

    06/27/2017, 3:34 PM
    I am trying out kotlin fullstack example i do
    git clone <https://github.com/Kotlin/kotlin-fullstack-sample>
    then
    gradlew build
    fails with error: npm ERR! notarget No matching version found for kotlin@1.1.1 tried deleting ~/.gradlew and ~/.npm but it doesn't help it workd for me last week.. i'm on ubuntu
    b
    c
    • 3
    • 4
  • d

    Dalinar

    06/27/2017, 6:02 PM
    how would this code be converted from a ts2kt header file? to working kotlin?
    @nativeGetter
    operator fun get(key: String): String? // use inline extension with body using dynamic
    
    companion object : QUnit by definedExternally: QUnit { } // can't use delegate on external
    
    fun begin(callback: `(details: `T$3`) -> Unit`) // unresolvable reference details
    code here gives errors or deprecated warnings
    b
    • 2
    • 14
  • n

    natpryce

    06/28/2017, 2:29 PM
    Q: is there a way to list the properties of a JavaScript object in Kotlin? I want to process all properties of a parsed JSON object, but cannot work out how to do it.
    k
    • 2
    • 1
  • d

    Dalinar

    06/29/2017, 9:06 AM
    does anyone know how to write this
    JSON.stringify({ x: 5 });            // '{"x":5}'
    in Kotlin ? it's the
    { x: 5}
    I don't understand how to do
    k
    • 2
    • 1
  • d

    Dalinar

    06/30/2017, 6:04 AM
    I have 2 projects (JS Kotlin). One recompiles upon changes. The other doesn't. They are normal projects (i.e. not maven or gradle).. would anyone have any idea why this it is not auto-recompiling?
    k
    • 2
    • 6
  • n

    natpryce

    06/30/2017, 10:18 AM
    How do JetBrains & other people distribute Kotlin libraries for the JavaScript platform? On Maven Central? NPM? Something else?
    b
    • 2
    • 6
  • g

    gaetan

    06/30/2017, 1:46 PM
    @konsoletyper Here is some feedback. I did some tests with DCE, AMD modules, and the code of data2viz. A simple
    println("Hello World")
    results after DCE -> requirejs optimization -> http zip in a 10 Ko file. I find that very good. Adding a line
    println(black)
    using the previous colors we discussed, raise the size to 16 Ko. Removing lazy initializations gets it down to 13 Ko.👏🎉
    👍 2
    k
    • 2
    • 4
  • g

    gbaldeck

    06/30/2017, 3:46 PM
    https://stackoverflow.com/questions/44850373/karma-cant-resolve-dependency-kotlin-in-kotlin-frontend-plugin
    a
    • 2
    • 3
  • t

    tlaukkan

    07/01/2017, 6:25 AM
    kotlinjs gradle does not seem to honor these settings: compileKotlinJs { kotlinOptions { kotlinOptions.outputFile = "${project.rootDir}/build/output.js" kotlinOptions.sourceMap = true } }
    n
    • 2
    • 2
  • t

    tlaukkan

    07/03/2017, 7:23 AM
    Is there anyway to change the mapping root?
    k
    • 2
    • 2
  • n

    natpryce

    07/03/2017, 9:33 AM
    What’s the official npm package for the Kotlin-js stdlib? The package
    kotlin
    has version 1.1.0, but my package is built with 1.1.3.
    b
    • 2
    • 5
  • t

    tlaukkan

    07/03/2017, 1:03 PM
    Is there something like encodeURIComponent for kotlin js
    k
    • 2
    • 3
  • t

    tlaukkan

    07/03/2017, 1:47 PM
    To what kotlinjs type corresponds to javascript map? For example if you serialize from kotlin a map how should it be deserialized in kotlinjs side?
    k
    • 2
    • 4
  • n

    natpryce

    07/03/2017, 2:18 PM
    Q: have the jquery bindings been moved to their own library now they’re deprecated in the stdlib?
    b
    • 2
    • 2
  • t

    tlaukkan

    07/03/2017, 4:28 PM
    For some reason kotlin std lib dom Element does not support append("<div></div")
    k
    • 2
    • 3
  • t

    tlaukkan

    07/03/2017, 5:32 PM
    Hmm how to parse milliseconds since epoch to javascript date in kotlin
    b
    • 2
    • 6
  • g

    gravyivan

    07/04/2017, 12:04 PM
    hey guys, does anyone know if there are plans to add Kotlin as Babel plugin to ease integration with current JS world?
    k
    • 2
    • 2
  • z

    zeckson

    07/04/2017, 12:51 PM
    hello, guys! Can I somehow pass
    process.argv
    into my
    main
    . I have following code:
    fun main(args: Array<String>) {
        val token = args[2]
    }
    Вut it transpiles to:
    (function (_, Kotlin) {
      'use strict';
      function main(args) {
        var token = args[2];
      }
      _.main_kand9s$ = main;
      main([]);
      Kotlin.defineModule('server', _);
      return _;
    }(module.exports, require('kotlin')));
    I’m using a workaround like this currently:
    fun main(args: Array<String>) {
        val token = process.argv[2]
    }
    But maybe is there a better solution?
    k
    • 2
    • 1
  • g

    gbaldeck

    07/05/2017, 8:10 PM
    Anyone know what the @Suppress("keyword_here") keyword is for dynamic variables that are implicitly cast to another type?
    b
    • 2
    • 5
Powered by Linen
Title
g

gbaldeck

07/05/2017, 8:10 PM
Anyone know what the @Suppress("keyword_here") keyword is for dynamic variables that are implicitly cast to another type?
b

bashor

07/05/2017, 8:28 PM
gbaldeck: 1. press
Alt+ Enter
when cursor on expression, 2. find “Implicit …” 3. press
right
4. select an option that is the best for you
In-short:
UnsafeCastFromDynamic
Btw, what do you think about this inspection? Is it useful or annoyed?
g

gbaldeck

07/05/2017, 10:51 PM
Ok thanks
Personally I find it annoying, reason being that every time I cast from dynamic to something else I'm very aware that casting is being done, so I don't need a warning telling me
View count: 1