Skip to content

Build your personal knowledge base with Trilium Notes

server-ts: Port services/search/expressions/parent_of

Elian Doran0f7f0ceedcf1
diff --git a/src/services/search/expressions/parent_of.js b/src/services/search/expressions/parent_of.ts
similarity index 68%
rename from src/services/search/expressions/parent_of.js
rename to src/services/search/expressions/parent_of.ts
index 9a474ed404..bd7b9d3046 100644
--- a/src/services/search/expressions/parent_of.js
+++ b/src/services/search/expressions/parent_of.ts
@@ -1,16 +1,19 @@
"use strict";
-const Expression = require('./expression');
-const NoteSet = require('../note_set');
+import Expression = require('./expression');
+import NoteSet = require('../note_set');
+import SearchContext = require('../search_context');
class ParentOfExp extends Expression {
- constructor(subExpression) {
+ private subExpression: Expression;
+
+ constructor(subExpression: Expression) {
super();
this.subExpression = subExpression;
}
- execute(inputNoteSet, executionContext, searchContext) {
+ execute(inputNoteSet: NoteSet, executionContext: {}, searchContext: SearchContext) {
const subInputNoteSet = new NoteSet();
for (const note of inputNoteSet.notes) {
@@ -33,4 +36,4 @@ class ParentOfExp extends Expression {
}
}
-module.exports = ParentOfExp;
+export = ParentOfExp;
diff --git a/src/services/search/services/parse.js b/src/services/search/services/parse.js
index eb6c03000c..28d6b6afec 100644
--- a/src/services/search/services/parse.js
+++ b/src/services/search/services/parse.js
@@ -6,7 +6,7 @@ const OrExp = require('../expressions/or');
const NotExp = require('../expressions/not');
const ChildOfExp = require('../expressions/child_of');
const DescendantOfExp = require('../expressions/descendant_of');
-const ParentOfExp = require('../expressions/parent_of.js');
+const ParentOfExp = require('../expressions/parent_of');
const RelationWhereExp = require('../expressions/relation_where.js');
const PropertyComparisonExp = require('../expressions/property_comparison.js');
const AttributeExistsExp = require('../expressions/attribute_exists');