T
TanStack8mo ago
fascinating-indigo

Skip navigate type check for an common component

I have a monorepo: apps |- admin |- client libs |- component |- util admin and client have common routes, so some common components are encapsulated. But now due to some complicated reasons, a component's function uses a route unique to client, so a type error will be thrown when admin is built. common component like:
function Component() {
const navigate = useNavigate();

function onClick() {
navigate({ to: '/only/client/route' })
// build type error ^ `admin` app not have this route
}
}
function Component() {
const navigate = useNavigate();

function onClick() {
navigate({ to: '/only/client/route' })
// build type error ^ `admin` app not have this route
}
}
All common components are exported in one export, but in fact, the admin does not use it
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?