Nikola Milovic
10/09/2021, 8:40 AMfun getDefaultValuesFromProfile(profile: ProfileModel): dynamic {
val d : dynamic = js("{ defaultValues : {...profile}}")
return d
}
Which should be totally valid in ts (javascript)
function test(profile: IProfile) {
const test = { defaultValues: { ...profile } };
}
CLOVIS
10/09/2021, 9:46 AMNikola Milovic
10/09/2021, 11:10 AMCLOVIS
10/09/2021, 11:24 AMNikola Milovic
10/09/2021, 11:46 AM> Task :web-app:compileDevelopmentExecutableKotlinJs FAILED
e: org.jetbrains.kotlin.com.google.gwt.dev.js.parserExceptions.JsParserException: syntax error at (0, 19)
With
fun getDefaultValuesFromProfile(profile: ProfileModel): dynamic {
val d: dynamic = js("{ defaultValues : {...profile}}")
turansky
10/09/2021, 12:30 PMdynamic
2. Avoid js
calls
First step:
fun getDefaultValuesFromProfile(profile: ProfileModel): dynamic {
return jso {
defaultValues = Object.clone(profile)
}
}
Second step:
Strict contracts, using external interfacesNikola Milovic
10/09/2021, 12:37 PM