ts-essentials#WritableKeys TypeScript Examples

The following examples show how to use ts-essentials#WritableKeys. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: settingsTabSection.ts    From obsidian-switcher-plus with GNU General Public License v3.0 6 votes vote down vote up
/**
   * Updates the internal SwitcherPlusSettings configStorageKey with value, and writes it to disk.
   * @param  {K} configStorageKey The SwitcherPlusSettings key where the value for this setting should be stored.
   * @param  {SwitcherPlusSettings[K]} value
   * @returns void
   */
  saveChangesToConfig<K extends WritableKeys<SwitcherPlusSettings>>(
    configStorageKey: K,
    value: SwitcherPlusSettings[K],
  ): void {
    const { config } = this;
    config[configStorageKey] = value;
    config.save();
  }