You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the TypeScript type definitions do not match the documentation nor the implementation. Here are the problems I've encountered so far in one afternoon of integrating the library:
<ErrorBoundary> has a fallbackUI prop, which is a ReactNode (the result of rendering a component) in types, but is assumed to be a function (a functional component) in the implementation. The correct type would most likely be React.ComponentType<{}> or React.FC<{}>.
historyContext has multiple issues:
The documentation (and implementation) claims to support both History v4 and History v5, but the types are only compatible with V4.
filter and formatter functions receive location as a string, but it is in fact a Location object, not a string.
filter and formatter are documented as optional, but they are required arguments in types.
Furthermore, the types are not correct even for V4:
The function returns a callback which receives an object consisting of action and filter, but this seems like a copy-paste mistake and the correct signature is probably (location: Location, action: string).
You need to define your own Location type, unless you want to take a dependency on history.
The text was updated successfully, but these errors were encountered:
Currently, the TypeScript type definitions do not match the documentation nor the implementation. Here are the problems I've encountered so far in one afternoon of integrating the library:
<ErrorBoundary>
has afallbackUI
prop, which is aReactNode
(the result of rendering a component) in types, but is assumed to be a function (a functional component) in the implementation. The correct type would most likely beReact.ComponentType<{}>
orReact.FC<{}>
.historyContext
has multiple issues:filter
andformatter
functions receivelocation
as a string, but it is in fact aLocation
object, not a string.filter
andformatter
are documented as optional, but they are required arguments in types.action
andfilter
, but this seems like a copy-paste mistake and the correct signature is probably(location: Location, action: string)
.Location
type, unless you want to take a dependency onhistory
.The text was updated successfully, but these errors were encountered: