Documentation incorrect #1148
Labels
contribution wanted
A maintainer wants help on an issue or pull request
documentation
A need for improvements or additions to documentation
The documentation for some API methods is incorrect or doesn't match the code. For example:
navigateToUrl
https://single-spa.js.org/docs/api#navigatetourl
navigateToUrl(document.querySelector('a'));
gives an error in TypeScript:See https://github.com/single-spa/single-spa/blob/master/typings/single-spa.d.ts#L207-L212.
document.querySelector('a').addEventListener(singleSpa.navigateToUrl);
also gives an error because the first parameter toaddEventListener
should be an event name. Even when corrected and adding the possible return ofnull
fromquerySelector
, there's still an error in Typescript with the type definition ofnavigateToUrl
not matching the event listener param:document.querySelector('a')?.addEventListener('click', navigateToUrl);
pathToActiveWhen
https://single-spa.js.org/docs/api#pathtoactivewhen
The documentation claims the return is a function that takes a
URL
and returns aboolean
, however according to the type definition, it takes aLocation
object:https://github.com/single-spa/single-spa/blob/master/typings/single-spa.d.ts#L127
It might work in Javascript since
Location
andURL
have the properties in common, but not Typescript. As such, all the examples shown in the documentation give errors in Typescript.The text was updated successfully, but these errors were encountered: