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';
* @prop {string} text -
* The markdown annotation body, which is either rendered as HTML (if `isEditing`
* is false) or displayed in a text area otherwise.
* @prop {MergedConfig} [settings]
* @prop {MergedConfig} settings
*/
/**
......
......@@ -20,7 +20,7 @@ import Timestamp from './timestamp';
* @typedef AnnotationHeaderProps
* @prop {Annotation} annotation
* @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] -
* Should document metadata be rendered? Hint: this is enabled for single annotation
* and stream views.
......
......@@ -9,8 +9,8 @@ import { applyTheme } from '../util/theme';
/**
* @typedef InlineControlsProps
* @prop {boolean} [isCollapsed]
* @prop {(collapsed: boolean) => any} [setCollapsed]
* @prop {boolean} isCollapsed
* @prop {(collapsed: boolean) => any} setCollapsed
* @prop {Object} [linkStyle]
*/
......
......@@ -16,7 +16,7 @@ import MenuItem from './menu-item';
* @typedef GroupListItemProps
* @prop {Group} group
* @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
* @prop {Object} analytics - Injected service
* @prop {Object} groups - Injected service
......
......@@ -12,9 +12,9 @@ import MenuSection from './menu-section';
* @typedef GroupListSectionProps
* @prop {Group|null} [expandedGroup]
* - 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 {(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
* expanded, or `null` if the expanded group is being collapsed.
*/
......
......@@ -31,8 +31,8 @@ function publisherProvidedIcon(settings) {
/**
* @typedef GroupListProps
* @prop {ServiceUrlGetter} [serviceUrl]
* @prop {MergedConfig} [settings]
* @prop {ServiceUrlGetter} serviceUrl
* @prop {MergedConfig} settings
*/
/**
......
......@@ -53,12 +53,12 @@ function authStateFromProfile(profile) {
/**
* @typedef HypothesisAppProps
* @prop {Object} [auth]
* @prop {Bridge} [bridge]
* @prop {ServiceUrlGetter} [serviceUrl]
* @prop {MergedConfig} [settings]
* @prop {Object} [session]
* @prop {Object} [toastMessenger]
* @prop {Object} auth
* @prop {Bridge} bridge
* @prop {ServiceUrlGetter} serviceUrl
* @prop {MergedConfig} settings
* @prop {Object} session
* @prop {Object} toastMessenger
*/
/**
......
......@@ -165,9 +165,9 @@ ToolbarButton.propTypes = {
/**
* @typedef ToolbarProps
* @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 {() => any} [onTogglePreview] - Callback invoked when the "Preview" toggle button is clicked.
* @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 {() => any} onTogglePreview - Callback invoked when the "Preview" toggle button is clicked.
*/
/**
......
......@@ -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 the query is non-empty.
* @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
*/
......
......@@ -11,8 +11,8 @@ import { withServices } from '../util/service-context';
* @typedef TagListProps
* @prop {Annotation} annotation - Annotation that owns the tags.
* @prop {string[]} tags - List of tags as strings.
* @prop {(a: string, b: Object<'tag', string>) => any} [serviceUrl] - Services
* @prop {Object} [settings]
* @prop {(a: string, b: Object<'tag', string>) => any} serviceUrl - Services
* @prop {{ authDomain: string }} settings
*/
/**
......
......@@ -18,7 +18,7 @@ import Thread from './thread';
* @typedef ThreadCardProps
* @prop {Thread} thread
* @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';
/**
* @typedef AuthState
* @prop {'logged-in'|'logged-out'} status
* @prop {string} [displayName]
* @prop {string} [userid]
* @prop {string} [username]
* @prop {string} [provider]
* @prop {string} displayName
* @prop {string} userid
* @prop {string} username
*/
/**
......
......@@ -43,9 +43,12 @@
* TODO - Fill out remaining properties
*
* @typedef Annotation
* @prop {string} [id]
* @prop {string} [$tag] - A locally-generated unique identifier for annotations
* that have not been saved to the service yet (and thus do not have an id)
* @prop {string} [id] -
* The server-assigned ID for the annotation. This is only set once the
* 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} created
* @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