diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2024-03-03 11:48:43 +0100 |
---|---|---|
committer | fenn-cs <fenn25.fn@gmail.com> | 2024-03-07 20:19:29 +0100 |
commit | 0fd31cdb4c1fb26bf5cd7645d4a187237687049d (patch) | |
tree | 6d3e5a126bc477c6d42fb462df6b78096c24b7e6 /core | |
parent | 20953d0374f434e0901c231f757751b954efca4d (diff) | |
download | nextcloud-server-0fd31cdb4c1fb26bf5cd7645d4a187237687049d.tar.gz nextcloud-server-0fd31cdb4c1fb26bf5cd7645d4a187237687049d.zip |
refactor: use TypeScript for unified-search boostrap file
This would allow us to type guard what is sent to`registerFilterAction`
for unified search, so that incompatibilties are caught quickly.
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/src/unified-search.ts (renamed from core/src/unified-search.js) | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/unified-search.js b/core/src/unified-search.ts index 4be923085d3..24571f149a4 100644 --- a/core/src/unified-search.js +++ b/core/src/unified-search.ts @@ -49,10 +49,19 @@ Vue.mixin({ }, }) +// Define type structure for unified searc action +interface UnifiedSearchAction { + id: string; + appId: string; + label: string; + icon: string; + callback: () => void; +} + // Register the add/register filter action API globally window.OCA = window.OCA || {} window.OCA.UnifiedSearch = { - registerFilterAction: ({ id, appId, label, callback, icon }) => { + registerFilterAction: ({ id, appId, label, callback, icon }: UnifiedSearchAction) => { const searchStore = useSearchStore() searchStore.registerExternalFilter({ id, appId, label, callback, icon }) }, |