russhwolf
04/05/2020, 1:08 AMkartoffelsup
04/05/2020, 8:53 AMp2000t
04/05/2020, 10:14 AMpablisco
04/06/2020, 8:27 AM"implementation"("dependency")
we can do implementation("dependency")
.
Does anyone (maybe from JB) knows if there are plans to, similarly, generate type safe mappings from npm dependencies on Kt JS? It would make it significantly easier to interop with js without having to create all the mappings manually (or wait for someone else to make a wrapper 🙃)galex
04/06/2020, 11:04 AMd.ts
file in a react app for example? Basically, what I don’t understand is that it declares the root project as a namespace
instead of a module
so when I try to import use the d.ts
and import my module I get the error lib.d.ts is not a module
.galex
04/06/2020, 3:00 PMllsouder
04/06/2020, 4:23 PMAndrew
04/07/2020, 5:02 AMpatrickdelconte
04/07/2020, 7:50 AMBuild file '.../hydrants/hydrants-cloud-functions/build.gradle.kts' line: 1
* What went wrong:
Plugin [id: 'org.jetbrains.kotlin.js'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)
line 1 of is _kotlin_(*“js”*)
inside the plugins block.
It is almost as if Idea tried to parse the gradle file as if it was a standalone projectFranco
04/08/2020, 7:23 AMJess Brent
04/08/2020, 2:35 PMinline fun <reified T> withResult(
method: Result<T>,
onFailure: (errors: List<Throwable>) -> Unit
): T {
@Suppress("IMPLICIT_CAST_TO_ANY")
val methodResult = when (method) {
is Result.Success -> { method.t }
is Result.Failure -> { onFailure.invoke(method.errors) }
}
return methodResult as T
}
usage:
val r = withResult(method) { return Result.Failure(it) }
i can get this function to work on jvm, however it does not work on js. it results in a ClassCastException
the transpiled js appears to show that instead of invoking onFailure
it is only assigned to methodResult
.
also, this is a custom sealed class Result
not kotlin.Result
steamstreet
04/09/2020, 4:21 AMRob Murdock
04/09/2020, 3:01 PMKiryushin Andrey
04/09/2020, 6:19 PMExecution failed for task ':jsBrowserProductionWebpack'.
> Process 'webpack' returns 2
I've narrowed the problem down to the usage of io.ktor.client.HttpClient
class. This error appears if I instantiate it or obtain its reflection descriptor in any part of the js source set and goes away if I remove all references of this class from the source set.
My Kotlin multiplatform plugin version is 1.3.71
and Ktor version is 1.3.2
. I have dependencies on both io.ktor:ktor-client-core
and io.ktor:ktor-client-js
in my jsMain source set.
Any help is appreciated - maybe anyone has ideas on why this is happening or at least how to gain more insight into what is happening during the webpack build.Rob Murdock
04/09/2020, 6:37 PMDarran
04/10/2020, 3:21 AMNicole
04/10/2020, 6:28 PMRobert Jaros
04/11/2020, 1:24 AMnode_modules
, but I need to force this in "project" `node_modules' (built/js/node_modules
).bod
04/11/2020, 4:59 PMis
returning false when it should return true 😛 I'm using a sealed class
for a state, which has a few `object`s and `data class`es as subclasses, and a when
like so:
when (state) {
is Foo -> doSomethingFoo()
is Bar -> doSomethingBar()
}
etc.
Any suggestions?yousuf.haque
04/11/2020, 7:36 PMFranco
04/12/2020, 12:36 AMbrowserDevelopmentRun
and browserProductionRun
but that feels like a "debug" and "release" thing where the former doesn't do any optimisations and the latter does.Franco
04/12/2020, 4:24 AMAny.asJsObject()
functions but that doesn't seem to do the trick.
My use case is that I'm trying to use the Firestore JS library to save some data but it only receives JS objects as input when trying to save data and I'm using normal Kotlin classes to handle this same data in the we app logic.yawkat
04/12/2020, 9:09 AMChaitanya Chunduri
04/14/2020, 2:29 PMAna Redmond
04/15/2020, 4:23 PMDaniel
04/17/2020, 12:50 PM.kt
file for the Alert
component and everything works fine exept importing the CSS resources. For now I dealt with this by importing the CSS file directly in html but I am wondering what would be the proper way of saying the following:
{/* The following line can be included in your src/index.js or App.js file*/}
import 'bootstrap/dist/css/bootstrap.min.css';
magnumrocha
04/18/2020, 11:16 AMKit
04/20/2020, 6:05 PMshama
04/23/2020, 5:13 AM@JsExport
class UIComponent {
val tagName: String = "h1"
}
It creates the following JS:
function UIComponent() {
this._tagName = 'h1';
}
UIComponent.prototype._get_tagName_ = function () {
return this._tagName;
};
Object.defineProperty(UIComponent.prototype, 'tagName', {
get: UIComponent.prototype._get_tagName_
});
Consuming the JS with: const h1 = new UIComponent(); Object.keys(h1);
only gives me the underscore prepended property ["_tagName"]
and for (let p in h1)
will enumerate through the _tagName
and _get_tagName_
properties but skip over the property I want, tagName
.
I was expecting the opposite, where _tagName
is not enumerable and tagName
is enumerable. The reason is lots of JS libs rely on hasOwnProperty()
and being able to enumerate through properties on an object considered its own. My specific use case is Ember.Component.extend(new UIComponent())
doesn’t work because it cannot enumerate and find the properties I have defined.
I think at the very least, enumerable: true
should be added to defineProperty()
or even better, the public properties get set in the constructor and the behind the scenes ones use defineProperty()
and keep the default enumerable: false
. But maybe there is a reason they are the way they are. Thanks!Grantas33
04/23/2020, 11:39 AMerror Couldn't find any versions for "kotlin" that matches "%%%KOTLIN_VERSION!!!"
> Task :kotlinNpmInstall FAILED
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns 1
My build.gradle.kts:
`
repositories {
maven("<https://kotlin.bintray.com/kotlin-js-wrappers/>")
mavenCentral()
jcenter()
}
dependencies {
implementation("org.jetbrains:kotlin-styled:1.0.0-pre.93-kotlin-1.3.70")
implementation(npm("styled-components"))
implementation(npm("inline-style-prefixer"))
implementation("org.jetbrains:kotlin-react:16.13.0-pre.93-kotlin-1.3.70")
implementation("org.jetbrains:kotlin-react-dom:16.13.0-pre.93-kotlin-1.3.70")
implementation("com.soywiz.korlibs.klock:klock-js:1.7.3")
implementation(npm("react", "16.13.1"))
implementation(npm("react-dom", "16.13.1"))
implementation(project(":common"))
}
kotlin.target.browser { }
I've tried removing all of the npm dependencies, yet the same error persists