Hi, simple question, how do I deal with theses typ...
# javascript
a
Hi, simple question, how do I deal with theses types of issues ? it's an abstract method also, but Intellij doesn't show it up
a
question is a bit unclear. Care to rephrase it?
t
possible the external method doesn’t have optional parameters, and its complaining about overriding them to be optional?
a
I'm trying to override an abstract external method that has one parameter with default value and I'm getting the error
Copy code
Overriding `external` function with optional parameters
e
you cannot change defaults when overriding
t
In most cases nullability rules are the same for parameters and properties. Optional == nullable
Copy code
// TS
draw(
    x?: number, 
    y?: number,
)

// Kotlin
fun draw(
    x: Double? = definedExternally, 
    y: Double? = definedExternally,
)
It’s even more transparent when you override method with optional parameters (your case)
Copy code
@file:Suppress("OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS")

... 

override fun draw(
    x: Double?, 
    y: Double?,
) {
    // job
}
cc @Sergei Grishchenko
h
I'm always surprised how many "errors" can be suppressed in JavaScript 😄
1
😜 2
👍 1
a
So I have to suppress the error, I would have never thought of this