unional
unional

Reputation: 15589

Function type with property in Kotlin

I can specify this in TypeScript (thus can be done in JavaScript):

interface Foo {
  (arg: any): void
  foo: string
}

Can the same thing achieved in Kotlin?

Upvotes: 1

Views: 50

Answers (1)

s1m0nw1
s1m0nw1

Reputation: 82017

This can be expressed in Kotlin, too:

interface Foo {
  fun funX(arg: Any): Unit
  val foo: String
}

Properties in Interfaces

Upvotes: 2

Related Questions