adoptSettingEx
Adopts a plain Setting into a SettingEx, returning the very same instance.
Obsidian’s declarative settings API creates the row itself and hands a plain Setting to a SettingDefinitionRender.render callback, so the extended adders are out of reach there. Re-pointing the instance’s prototype at SettingEx.prototype makes them available on the object Obsidian already owns and keeps rendering: SettingEx declares no instance state and its constructor only delegates to super, and SettingEx.prototype inherits from the very Setting.prototype the instance came from, so every method Obsidian relies on — including the ones absent from the public typings — stays reachable.
Import:
import { adoptSettingEx } from 'obsidian-dev-utils/obsidian/setting-ex';Signature:
function adoptSettingEx(setting: Setting): SettingExParameters:
| Parameter | Type | Description |
|---|---|---|
setting | Setting | The setting to adopt. |
Returns: SettingEx — The same instance, typed as a SettingEx.