Follow-up from #613 (comment by @zekehuntergreen).
getDefaultView currently returns string | undefined. The actual set of view
mode values is finite and known:
"text"
"preview"
"table"
`ocr.${string}`
`transcript.${string}`
`vttTranscript.${string}`
We should define a shared ViewMode type and use it across:
getDefaultView return type
setResourceView parameter (currently any)
SetResourceViewType Redux action (currently view: any)
PreviewSwitcher navigate callbacks and PreviewLink props
This would catch invalid view strings at compile time and make the view mode
contract explicit.
Labels: document viewer, enhancement
Follow-up from #613 (comment by @zekehuntergreen).
getDefaultViewcurrently returnsstring | undefined. The actual set of viewmode values is finite and known:
"text""preview""table"`ocr.${string}``transcript.${string}``vttTranscript.${string}`We should define a shared
ViewModetype and use it across:getDefaultViewreturn typesetResourceViewparameter (currentlyany)SetResourceViewTypeRedux action (currentlyview: any)PreviewSwitchernavigate callbacks andPreviewLinkpropsThis would catch invalid view strings at compile time and make the view mode
contract explicit.
Labels: document viewer, enhancement