Commit 5e122026 authored by Kyle Keating's avatar Kyle Keating Committed by Kyle Keating

Improve typecheck (focus-mode-header, store/selection)

parent 8655a056
...@@ -479,6 +479,9 @@ function focusModeUserPrettyName(state) { ...@@ -479,6 +479,9 @@ function focusModeUserPrettyName(state) {
return state.focusMode.user.displayName; return state.focusMode.user.displayName;
} }
/**
* @type {(state: any) => string[]}
*/
const forcedVisibleAnnotations = createSelector( const forcedVisibleAnnotations = createSelector(
state => state.forcedVisible, state => state.forcedVisible,
forcedVisible => trueKeys(forcedVisible) forcedVisible => trueKeys(forcedVisible)
...@@ -488,7 +491,7 @@ const forcedVisibleAnnotations = createSelector( ...@@ -488,7 +491,7 @@ const forcedVisibleAnnotations = createSelector(
* Returns the annotation ID of the first annotation in the selection that is * Returns the annotation ID of the first annotation in the selection that is
* selected (`true`) or `null` if there are none. * selected (`true`) or `null` if there are none.
* *
* @return {string|null} * @type {(state: any) => string|null}
*/ */
const getFirstSelectedAnnotationId = createSelector( const getFirstSelectedAnnotationId = createSelector(
state => state.selected, state => state.selected,
...@@ -501,13 +504,16 @@ const getFirstSelectedAnnotationId = createSelector( ...@@ -501,13 +504,16 @@ const getFirstSelectedAnnotationId = createSelector(
/** /**
* Are any annotations currently selected? * Are any annotations currently selected?
* *
* @return {boolean} * @type {(state: any) => boolean}
*/ */
const hasSelectedAnnotations = createSelector( const hasSelectedAnnotations = createSelector(
state => state.selected, state => state.selected,
selection => trueKeys(selection).length > 0 selection => trueKeys(selection).length > 0
); );
/**
* @type {(state: any) => string[]}
*/
const selectedAnnotations = createSelector( const selectedAnnotations = createSelector(
state => state.selected, state => state.selected,
selection => trueKeys(selection) selection => trueKeys(selection)
...@@ -518,7 +524,7 @@ const selectedAnnotations = createSelector( ...@@ -518,7 +524,7 @@ const selectedAnnotations = createSelector(
* includes a search query, but also if annotations are selected or a user * includes a search query, but also if annotations are selected or a user
* is focused. * is focused.
* *
* @return {boolean} * @type {(state: any) => boolean}
*/ */
const hasAppliedFilter = createSelector( const hasAppliedFilter = createSelector(
filterQuery, filterQuery,
...@@ -608,7 +614,18 @@ const threadState = createSelector( ...@@ -608,7 +614,18 @@ const threadState = createSelector(
* @prop {typeof toggleSelectedAnnotations} toggleSelectedAnnotations * @prop {typeof toggleSelectedAnnotations} toggleSelectedAnnotations
* *
* // Selectors * // Selectors
* // TODO: add the rest * @prop {() => Object<string,boolean>} expandedMap
* @prop {() => string|null} filterQuery
* @prop {() => boolean} focusModeActive
* @prop {() => boolean} focusModeConfigured
* @prop {() => string|null} focusModeUserFilter
* @prop {() => string} focusModeUserPrettyName
* @prop {() => string[]} forcedVisibleAnnotations
* @prop {() => string|null} getFirstSelectedAnnotationId
* @prop {() => boolean} hasAppliedFilter
* @prop {() => boolean} hasSelectedAnnotations
* @prop {() => string[]} selectedAnnotations
* @prop {() => string[]} sortKeys
*/ */
export default { export default {
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
"sidebar/components/annotation-viewer-content.js", "sidebar/components/annotation-viewer-content.js",
"sidebar/components/annotation.js", "sidebar/components/annotation.js",
"sidebar/components/filter-status.js", "sidebar/components/filter-status.js",
"sidebar/components/focused-mode-header.js",
"sidebar/components/group-list-item.js", "sidebar/components/group-list-item.js",
"sidebar/components/group-list-section.js", "sidebar/components/group-list-section.js",
"sidebar/components/group-list.js", "sidebar/components/group-list.js",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment