How to use Device::onSettings()?

Hi,
I’m looking for a code example on how to read a settings value from the newSettings object parameter in the Device::onSettings() function. I have defined a “checkbox” type setting in the driver.settings.compose.json file. I can see that the settings key+value are in the newSettings object (using “this.log(newSettings)”), but I can’t figure out how to read the actual value from the object in my device code. Probably because I don’t fully get TypeScript…

Do I need to change the onSettings() function definition (compared to the code in Settings | Homey Apps SDK) in my project to indicate object type of the newSettings parameter?

“homey app build” just fails with:
error TS2339: Property ‘abc’ does not exist on type ‘{}’.
when I in my onSettings() try to call
this.log(newSettings.abc)"

Thanks!

This is how the method is defined if you use homey app driver create:

  async onSettings({
    oldSettings,
    newSettings,
    changedKeys,
  }: {
    oldSettings: { [key: string]: boolean | string | number | undefined | null };
    newSettings: { [key: string]: boolean | string | number | undefined | null };
    changedKeys: string[];
  }): Promise<string | void> {
    this.log("MyDevice settings where changed");
  }

Thanks for the info, Robert!
Turns out the onSettings method definition in my app was incomplete (parameter types were missing). I made it equal to the autogenerated (which you shared), and now “newSettings.abc” works.