Commit f7f7df73 authored by Robert Knight's avatar Robert Knight

Correct optional-ness of various properties in JSDoc types

This fixes errors with TS >= 4.0 which treats optional properties of
type T as being `T|undefined`.
parent 04eb49cf
...@@ -28,7 +28,7 @@ import TagList from './tag-list'; ...@@ -28,7 +28,7 @@ import TagList from './tag-list';
* @prop {string} text - * @prop {string} text -
* The markdown annotation body, which is either rendered as HTML (if `isEditing` * The markdown annotation body, which is either rendered as HTML (if `isEditing`
* is false) or displayed in a text area otherwise. * is false) or displayed in a text area otherwise.
* @prop {MergedConfig} [settings] * @prop {MergedConfig} settings
*/ */
/** /**
......
...@@ -20,7 +20,7 @@ import Timestamp from './timestamp'; ...@@ -20,7 +20,7 @@ import Timestamp from './timestamp';
* @typedef AnnotationHeaderProps * @typedef AnnotationHeaderProps
* @prop {Annotation} annotation * @prop {Annotation} annotation
* @prop {boolean} [isEditing] - Whether the annotation is actively being edited * @prop {boolean} [isEditing] - Whether the annotation is actively being edited
* @prop {number} [replyCount] - How many replies this annotation currently has * @prop {number} replyCount - How many replies this annotation currently has
* @prop {boolean} [showDocumentInfo] - * @prop {boolean} [showDocumentInfo] -
* Should document metadata be rendered? Hint: this is enabled for single annotation * Should document metadata be rendered? Hint: this is enabled for single annotation
* and stream views. * and stream views.
......
...@@ -9,8 +9,8 @@ import { applyTheme } from '../util/theme'; ...@@ -9,8 +9,8 @@ import { applyTheme } from '../util/theme';
/** /**
* @typedef InlineControlsProps * @typedef InlineControlsProps
* @prop {boolean} [isCollapsed] * @prop {boolean} isCollapsed
* @prop {(collapsed: boolean) => any} [setCollapsed] * @prop {(collapsed: boolean) => any} setCollapsed
* @prop {Object} [linkStyle] * @prop {Object} [linkStyle]
*/ */
......
...@@ -16,7 +16,7 @@ import MenuItem from './menu-item'; ...@@ -16,7 +16,7 @@ import MenuItem from './menu-item';
* @typedef GroupListItemProps * @typedef GroupListItemProps
* @prop {Group} group * @prop {Group} group
* @prop {boolean} [isExpanded] - Whether the submenu for this group is expanded * @prop {boolean} [isExpanded] - Whether the submenu for this group is expanded
* @prop {(expand: boolean) => any} [onExpand] - * @prop {(expand: boolean) => any} onExpand -
* Callback invoked to expand or collapse the current group * Callback invoked to expand or collapse the current group
* @prop {Object} analytics - Injected service * @prop {Object} analytics - Injected service
* @prop {Object} groups - Injected service * @prop {Object} groups - Injected service
......
...@@ -12,9 +12,9 @@ import MenuSection from './menu-section'; ...@@ -12,9 +12,9 @@ import MenuSection from './menu-section';
* @typedef GroupListSectionProps * @typedef GroupListSectionProps
* @prop {Group|null} [expandedGroup] * @prop {Group|null} [expandedGroup]
* - The `Group` whose submenu is currently expanded, or `null` if no group is currently expanded * - The `Group` whose submenu is currently expanded, or `null` if no group is currently expanded
* @prop {Group[]} [groups] - The list of groups to be displayed in the group list section * @prop {Group[]} groups - The list of groups to be displayed in the group list section
* @prop {string} [heading] - The string name of the group list section * @prop {string} [heading] - The string name of the group list section
* @prop {(group: Group|null) => any} [onExpandGroup] - * @prop {(group: Group|null) => any} onExpandGroup -
* Callback invoked when a group is expanded or collapsed. The argument is the group being * Callback invoked when a group is expanded or collapsed. The argument is the group being
* expanded, or `null` if the expanded group is being collapsed. * expanded, or `null` if the expanded group is being collapsed.
*/ */
......
...@@ -31,8 +31,8 @@ function publisherProvidedIcon(settings) { ...@@ -31,8 +31,8 @@ function publisherProvidedIcon(settings) {
/** /**
* @typedef GroupListProps * @typedef GroupListProps
* @prop {ServiceUrlGetter} [serviceUrl] * @prop {ServiceUrlGetter} serviceUrl
* @prop {MergedConfig} [settings] * @prop {MergedConfig} settings
*/ */
/** /**
......
...@@ -53,12 +53,12 @@ function authStateFromProfile(profile) { ...@@ -53,12 +53,12 @@ function authStateFromProfile(profile) {
/** /**
* @typedef HypothesisAppProps * @typedef HypothesisAppProps
* @prop {Object} [auth] * @prop {Object} auth
* @prop {Bridge} [bridge] * @prop {Bridge} bridge
* @prop {ServiceUrlGetter} [serviceUrl] * @prop {ServiceUrlGetter} serviceUrl
* @prop {MergedConfig} [settings] * @prop {MergedConfig} settings
* @prop {Object} [session] * @prop {Object} session
* @prop {Object} [toastMessenger] * @prop {Object} toastMessenger
*/ */
/** /**
......
...@@ -165,9 +165,9 @@ ToolbarButton.propTypes = { ...@@ -165,9 +165,9 @@ ToolbarButton.propTypes = {
/** /**
* @typedef ToolbarProps * @typedef ToolbarProps
* @prop {boolean} [isPreviewing] - `true` if the editor's "Preview" mode is active. * @prop {boolean} isPreviewing - `true` if the editor's "Preview" mode is active.
* @prop {(a: ButtonID) => any} [onCommand] - Callback invoked with the selected command when a toolbar button is clicked. * @prop {(a: ButtonID) => any} onCommand - Callback invoked with the selected command when a toolbar button is clicked.
* @prop {() => any} [onTogglePreview] - Callback invoked when the "Preview" toggle button is clicked. * @prop {() => any} onTogglePreview - Callback invoked when the "Preview" toggle button is clicked.
*/ */
/** /**
......
...@@ -14,7 +14,7 @@ import Spinner from './spinner'; ...@@ -14,7 +14,7 @@ import Spinner from './spinner';
* If true, the input field is always shown. If false, the input field is only shown * If true, the input field is always shown. If false, the input field is only shown
* if the query is non-empty. * if the query is non-empty.
* @prop {string|null} query - The currently active filter query * @prop {string|null} query - The currently active filter query
* @prop {(value: string) => any} [onSearch] - * @prop {(value: string) => any} onSearch -
* Callback to invoke when the current filter query changes * Callback to invoke when the current filter query changes
*/ */
......
...@@ -11,8 +11,8 @@ import { withServices } from '../util/service-context'; ...@@ -11,8 +11,8 @@ import { withServices } from '../util/service-context';
* @typedef TagListProps * @typedef TagListProps
* @prop {Annotation} annotation - Annotation that owns the tags. * @prop {Annotation} annotation - Annotation that owns the tags.
* @prop {string[]} tags - List of tags as strings. * @prop {string[]} tags - List of tags as strings.
* @prop {(a: string, b: Object<'tag', string>) => any} [serviceUrl] - Services * @prop {(a: string, b: Object<'tag', string>) => any} serviceUrl - Services
* @prop {Object} [settings] * @prop {{ authDomain: string }} settings
*/ */
/** /**
......
...@@ -18,7 +18,7 @@ import Thread from './thread'; ...@@ -18,7 +18,7 @@ import Thread from './thread';
* @typedef ThreadCardProps * @typedef ThreadCardProps
* @prop {Thread} thread * @prop {Thread} thread
* @prop {Object} frameSync - Injected service * @prop {Object} frameSync - Injected service
* @prop {MergedConfig} [settings] - Injected service * @prop {MergedConfig} settings - Injected service
*/ */
/** /**
......
...@@ -18,11 +18,9 @@ import SvgIcon from '../../shared/components/svg-icon'; ...@@ -18,11 +18,9 @@ import SvgIcon from '../../shared/components/svg-icon';
/** /**
* @typedef AuthState * @typedef AuthState
* @prop {'logged-in'|'logged-out'} status * @prop {string} displayName
* @prop {string} [displayName] * @prop {string} userid
* @prop {string} [userid] * @prop {string} username
* @prop {string} [username]
* @prop {string} [provider]
*/ */
/** /**
......
...@@ -43,9 +43,12 @@ ...@@ -43,9 +43,12 @@
* TODO - Fill out remaining properties * TODO - Fill out remaining properties
* *
* @typedef Annotation * @typedef Annotation
* @prop {string} [id] * @prop {string} [id] -
* @prop {string} [$tag] - A locally-generated unique identifier for annotations * The server-assigned ID for the annotation. This is only set once the
* that have not been saved to the service yet (and thus do not have an id) * annotation has been saved to the backend
* @prop {string} $tag - A locally-generated unique identifier for annotations.
* This is set for all annotations, whether they have been saved to the backend
* or not.
* @prop {string[]} [references] * @prop {string[]} [references]
* @prop {string} created * @prop {string} created
* @prop {boolean} [flagged] * @prop {boolean} [flagged]
......
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