Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
Kotlin/JS missing fun when compiled

I am trying to compile Kotlin to JavaScript. It is used from JavaScript project as npm module.

For example, when I wrote a Class like the one below, I can't see a method like fun hoge (fuga: SomeClass) from JavaScript. It will be undefined.

Enviroment

  • Kotlin 1.5.31
  • gradle 7.0.2

Fuga.kt

package com.example

class Fuga {
  fun hoge(someClass: SomeClass) {
     // Do something
  }

  fun hoge2() = "Hello"
}

JavaScript(Typescript) Project

import F from "npm_module";

const v = new F.com.example.Fuga();

console.log(v.hoge2()); // displayed Hello

v.hoge(someClass); // hoge is undefined

Why missing hoge(someClass) ? How can hoge(someClass) be referenced from a JavaScript Project?

Thank you.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Missing function hoge(someClass) was renamed when build to js. For example, hoge_xyz$.

missing function hoge (someClass) was renamed when build to js.

For example, hoge_xyz $

By using @JsName, I was able to refer to it with the intended name from Js without being renamed.

package com.example

class Fuga {

  @JsName("hoge")
  fun hoge(someClass: SomeClass) {
     // Do something
  }

  fun hoge2() = "Hello"
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!