Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Improve typing of preferences snippets

Smaug6739cc00a26839cc
diff --git a/frontend/app/composables/Preferences.ts b/frontend/app/composables/Preferences.ts
index bd7bf427..fd9675f6 100644
--- a/frontend/app/composables/Preferences.ts
+++ b/frontend/app/composables/Preferences.ts
@@ -39,7 +39,7 @@ export const DEFAULT_PREFERENCES = {
{ id: '!m', label: '$$0$' },
{ id: '!property', label: ':::property $0\n\n:::' },
{ id: '!warning', label: ':::warning $0\n\n:::' },
- ] as ANode[],
+ ] as ANode<string>[],
editorFontFamily: 'JetBrains Mono' as string,
editorFontSize: 14 as number,
developerMode: false as boolean,
@@ -74,12 +74,12 @@ watch(preferences, savePreferences, { deep: true });
export function usePreferences() {
function get<K extends PreferenceKey>(key: K) {
// Crée un ref réactif lié à la valeur des preferences
- const r = ref(preferences.value[key]);
+ const r = ref(preferences.value[key]) as Ref<Preferences[K]>;
// Watch pour propager les changements dans le store
watch(
r,
- (val: Preferences[K]) => {
+ val => {
preferences.value[key] = val;
},
{ deep: true },