You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clone the project, checkout the broken commit, and install.
git clone https://github.com/remcohaszing/recma-nextjs-static-props.git
cd recma-nextjs-static-props
git checkout 3944549ef8923e91bb3a8ee2542fbc4e67a69e9b
npm ci
Validate the project with TypeScript.
npx tsc --build
Great! That works. Now clean up.
npx tsc --build --clean
Build the project with Next.js.
npx next build
Observe the type error.
▲ Next.js 14.2.4
Linting and checking validity of types ...Failed to compile.
./fixtures/custom-name/options.js:2:51
Type error: Could not find a declaration file for module 'recma-nextjs-static-props'.
'/home/remco/Projects/recma-nextjs-static-props/lib/recma-nextjs-static-props.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/recma-nextjs-static-props` if it exists or add a new declaration (.d.ts) file containing `declare module 'recma-nextjs-static-props';`
1 | /**
> 2 | * @import { RecmaNextjsStaticPropsOptions } from 'recma-nextjs-static-props'
| ^
3 | */
4 |
5 | /**
Current vs. Expected behavior
If tsc --build works, I expect next build to not throw type errors. The likely culprit is that next build doesn’t understand TypeScript project references.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #202405300957~1718348209~22.04~7817b67 SMP PREEMPT_DYNAMIC Mon J
Available memory (MB): 31807
Available CPU cores: 12
Binaries:
Node: 22.3.0
npm: 10.8.1
Yarn: 1.22.22
pnpm: 9.4.0
Relevant Packages:
next: 14.2.4 // Latest available version is detected (14.2.4).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.5.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
TypeScript
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
As a workaround, users can add the following to next.config.mjs:
Link to the code that reproduces this issue
https://github.com/remcohaszing/recma-nextjs-static-props/tree/3944549ef8923e91bb3a8ee2542fbc4e67a69e9b
To Reproduce
git clone https://github.com/remcohaszing/recma-nextjs-static-props.git cd recma-nextjs-static-props git checkout 3944549ef8923e91bb3a8ee2542fbc4e67a69e9b npm ci
Current vs. Expected behavior
If
tsc --build
works, I expectnext build
to not throw type errors. The likely culprit is thatnext build
doesn’t understand TypeScript project references.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #202405300957~1718348209~22.04~7817b67 SMP PREEMPT_DYNAMIC Mon J Available memory (MB): 31807 Available CPU cores: 12 Binaries: Node: 22.3.0 npm: 10.8.1 Yarn: 1.22.22 pnpm: 9.4.0 Relevant Packages: next: 14.2.4 // Latest available version is detected (14.2.4). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: 5.5.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
TypeScript
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
As a workaround, users can add the following to
next.config.mjs
:The text was updated successfully, but these errors were encountered: