beastieboardB
tRPC11mo ago
3 replies
beastieboard

Router type = any in monorepo...

Using typescript 5.8.2, trpc 11.0.0-rc.688

I have my server and frontend in separate packages, and when importing the AppRouter (
import type { AppRouter } from 'api'
) , the type of AppRouter is
any
:/.

I've followed all the steps from the FAQ, but to no avail.

In the exporting package's package.json I am using:
"module": "src/module.ts",
, and module.ts has:

export type { AppRouter } from './routes'
export type A = [number]                 


When importing using
import type
, the type of
A
is visible but
AppRouter
is
any
.

Any help appreciated.

SOLVED!!

The problem was the use of path aliases in the api. I changed an
import ... from "@/..."
to
import ... from "../..."
and it started working.
Solution
SOLVED!!

The problem was the use of path aliases in the api. I changed an import ... from "@/..." to import ... from "../..." and it started working.
Was this page helpful?