Skip to content

Build your personal knowledge base with Trilium Notes

chore(client/ts): port services/attribute_autocomplete

Elian Doran39b82b4c980a
diff --git a/src/public/app/services/attribute_autocomplete.js b/src/public/app/services/attribute_autocomplete.ts
similarity index 91%
rename from src/public/app/services/attribute_autocomplete.js
rename to src/public/app/services/attribute_autocomplete.ts
index 761d5dbeb3..04c601f461 100644
--- a/src/public/app/services/attribute_autocomplete.js
+++ b/src/public/app/services/attribute_autocomplete.ts
@@ -20,7 +20,7 @@ function initAttributeNameAutocomplete({ $el, attributeType, open }) {
source: async (term, cb) => {
const type = typeof attributeType === "function" ? attributeType() : attributeType;
- const names = await server.get(`attribute-names/?type=${type}&query=${encodeURIComponent(term)}`);
+ const names = await server.get<string[]>(`attribute-names/?type=${type}&query=${encodeURIComponent(term)}`);
const result = names.map(name => ({name}));
cb(result);
@@ -52,7 +52,7 @@ async function initLabelValueAutocomplete({ $el, open, nameCallback }) {
return;
}
- const attributeValues = (await server.get(`attribute-values/${encodeURIComponent(attributeName)}`))
+ const attributeValues = (await server.get<string[]>(`attribute-values/${encodeURIComponent(attributeName)}`))
.map(attribute => ({ value: attribute }));
if (attributeValues.length === 0) {