Next.js Discord

Discord Forum

Type checking fails for next build but works with npx tsc

Unanswered
Red-whiskered Bulbul posted this in #help-forum
Open in Discord
Red-whiskered BulbulOP
I am setting up Nativewind for a monorepo, in a shared UI package (which is used by Next.js & Expo). The process to make Typescript work is to add a triple-slash directive.

When running npx tsc within each workspace, no errors come up - not even in the Next.js workspace.
However, when running next build I get Typescript errors, complaining about the shared UI workspace having Typescript errors.

I'm wondering why Typescript might be failing within next build, but not when running npx tsc?

3 Replies

Red-whiskered BulbulOP
Deps info:
typescript: 5.4.5 (defined at repo root)
next: 14.2.2 (have tried ^14.1.0 too)
nativewind: ^4.0.36
Just tried switching over from yarn v4 over to pnpm, still no luck. I noticed that nativewind wasn't being installed in my Next.js app's node_modules when using yarn
So I was using "references" in tsconfig and was pointing to the shared workspace. When I removed that, regular tsc was causing errors too and not only the next build.