Skip to content

Commit

Permalink
fix: generic
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantwrp committed Sep 29, 2024
1 parent e45199e commit 50c777e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/settings/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const createSimpleSetting = <T>(id: string, manifest: SettingItem): Plugi
}

/**
* This considers that the original setting is of type string. On `set` if no original value
* can be calculated, the setting is set to an empty string.
* This considers that the original setting is of type `string`. On `set` if no original value
* can be traced back, the setting is set to an empty string.
*/
export const createEnumSetting = <T>(id: string, manifest: SettingItem, valueMap: Record<string, T>, defaultValue: T): PluginSetting<T> => {
export const createMappedSetting = <T>(id: string, manifest: SettingItem, valueMap: Record<string, T>, defaultValue: T): PluginSetting<T> => {
return class {
static id = id;
static manifest = manifest;
Expand Down
4 changes: 2 additions & 2 deletions src/settings/templatesSource.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SettingItemType } from "api/types";
import { createEnumSetting } from "./base";
import { createMappedSetting } from "./base";

export enum TemplatesSource {
Tag,
Notebook,
}

export const TemplatesSourceSetting = createEnumSetting<TemplatesSource>("templatesSource", {
export const TemplatesSourceSetting = createMappedSetting<TemplatesSource>("templatesSource", {
public: true,
type: SettingItemType.String,
isEnum: true,
Expand Down

0 comments on commit 50c777e

Please sign in to comment.