aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/actions
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-12-21 12:06:41 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-12-21 12:06:41 +0100
commitf0c8cf0e79f003514fd65a70def5820205955a77 (patch)
treecb66d325fb5d16d8b7fa0f14c91ad17dd4ff7c6c /src/client/react/actions
parent569b2969d530f08e55798c5cb3079948c7c037cd (diff)
Move to typescript
Diffstat (limited to 'src/client/react/actions')
-rw-r--r--src/client/react/actions/search.js14
-rw-r--r--src/client/react/actions/search.ts24
2 files changed, 24 insertions, 14 deletions
diff --git a/src/client/react/actions/search.js b/src/client/react/actions/search.js
deleted file mode 100644
index 1b6847d..0000000
--- a/src/client/react/actions/search.js
+++ /dev/null
@@ -1,14 +0,0 @@
-export const inputChange = typedValue => ({
- type: 'SEARCH/INPUT_CHANGE',
- typedValue,
-});
-
-/**
- * Change the selected result.
- * @param {+1/-1} relativeChange usually +1 or -1, the change relative to the
- * current result.
- */
-export const changeSelectedResult = relativeChange => ({
- type: 'SEARCH/CHANGE_SELECTED_RESULT',
- relativeChange,
-});
diff --git a/src/client/react/actions/search.ts b/src/client/react/actions/search.ts
new file mode 100644
index 0000000..45c31fb
--- /dev/null
+++ b/src/client/react/actions/search.ts
@@ -0,0 +1,24 @@
+export interface InputChangeAction {
+ type: 'SEARCH/INPUT_CHANGE',
+ typedValue: string,
+}
+
+export const inputChange = (typedValue: string): InputChangeAction => ({
+ type: 'SEARCH/INPUT_CHANGE',
+ typedValue,
+});
+
+export interface ChangeSelectedResultAction {
+ type: 'SEARCH/CHANGE_SELECTED_RESULT',
+ relativeChange: 1 | -1,
+}
+
+/**
+ * Change the selected result.
+ * @param {+1/-1} relativeChange usually +1 or -1, the change relative to the
+ * current result.
+ */
+export const changeSelectedResult = (relativeChange: 1 | -1): ChangeSelectedResultAction => ({
+ type: 'SEARCH/CHANGE_SELECTED_RESULT',
+ relativeChange,
+});