Skip to content

Add explicit return type to getSettingDefinitions() examples - #263

Open
sgreg wants to merge 1 commit into
obsidianmd:mainfrom
sgreg:declarative-settings-return-type
Open

Add explicit return type to getSettingDefinitions() examples#263
sgreg wants to merge 1 commit into
obsidianmd:mainfrom
sgreg:declarative-settings-return-type

Conversation

@sgreg

@sgreg sgreg commented Aug 23, 2026

Copy link
Copy Markdown

Created a new plugin using obsidianmd/obsidian-sample-plugin@07ceb81 as template, and wanted to try out the new declarative settings.

However, copying the examples from the documentation as-is caused build errors Type '{ type: string; key: string; defaultValue?: undefined; options?: undefined; placeholder?: undefined; validate?: undefined; }' is not assignable to type 'SettingFolderControl<string>' for getSettingDefinitions().

Declaring SettingDefinitionItem[] explicitly as getSettingDefinitions()'s return type solved it, so adding that to the migration and Settings examples.

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

Successfully merging this pull request may close these issues.

1 participant