kruschid / typesafe-routes

Spices up your favorite routing library by adding type safety to plain string-based route definitions.
https://kruschid.github.io/typesafe-routes/
MIT License
102 stars 8 forks source link

Has a dependency on react/react-router #28

Closed anilanar closed 1 year ago

anilanar commented 1 year ago

index.ts re-exports react-router.ts, which depends on react and react-router-dom. So if a project doesn't have those dependencies, then it's impossible to use typesafe-routes.

I suggest react-router related dependencies are not re-exported from index.ts. So users that want to use react-router utilities can import it as typesafe-routes/react-router instead.

anilanar commented 1 year ago

Workaround:

import { route } from "typesafe-routes/build/route";
import { intParser } from "typesafe-routes//build/parser";
kruschid commented 1 year ago

thanks for reporting, I'll take a look.

kruschid commented 1 year ago

I suggest react-router related dependencies are not re-exported from index.ts. So users that want to use react-router utilities can import it as typesafe-routes/react-router instead.

Yep that's exactly how it's implemented now in the latest update. Thanks again.