preactjs / preact-router

:earth_americas: URL router for Preact.
http://npm.im/preact-router
MIT License
1.01k stars 156 forks source link

Update Router and Link type definitions #435

Open billybimbob opened 1 year ago

billybimbob commented 1 year ago

This PR modifies the type definitions to Router and Link in order to better represent their actual implmentations.

The type definitions for the Link component in preact-router and preact-router/match have some ambiguity between each other, which causes problems like #379. The base Link type definition is now more restricted to make clear that activeClassName can only be applied to the match variant.

onClick is also now omitted as a link prop in order to ensure that the onClick handler used by preact-router is not overriden.

The match Link variant can also now take in extra props of activeClass and path.