Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do we prevent computed properties from being generated #26

Open
Sethuraman opened this issue Nov 27, 2020 · 1 comment
Open

How do we prevent computed properties from being generated #26

Sethuraman opened this issue Nov 27, 2020 · 1 comment

Comments

@Sethuraman
Copy link

I have a data class with a computed property. The computed property is also present in the generated interface.

data class Test(
   val isOn: Boolean
) {
  val isOff: Boolean
    get() {
        return !isOn
    }
}

Generated Interface

interface Test {
  isOn: boolean
  isOff: boolean
}

Is there a way to turn off generation of computed properties?

@brezinajn
Copy link

That inteface is correct :). But I can see what you are trying to do. You can use:

data class Test(
   val isOn: Boolean
)

val Test.isOff: Boolean
    get() = !isOn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants