oscklm
oscklm12mo ago

convex-helpers preventing my turbo build from running?

I have no clue what is the reason behind this, ive tried multiple approaches to finding out the reason why this error is happening, but wihtout luck?
flimmer git:(main) ✗ npx turbo run build --filter=admin-dashboard
• Packages in scope: admin-dashboard
• Running build in 1 packages
• Remote caching disabled
admin-dashboard:build: cache miss, executing 19cd75ee5e61ff3f
admin-dashboard:build:
yarn run v1.22.21
$ next build
admin-dashboard:build: ▲ Next.js 14.1.3
admin-dashboard:build: - Environments: .env.production
admin-dashboard:build:
admin-dashboard:build: Creating an optimized production build ...
admin-dashboard:build: ✓ Compiled successfully
Linting and checking validity of types ...ESLint: Failed to load config "@repo/eslint-config/library.js" to extend from. Referenced from: /Users/oscdot/Repos/flimmer/.eslintrc.js
Linting and checking validity of types ...Failed to compile.
admin-dashboard:build:
admin-dashboard:build: ../../node_modules/convex-helpers/index.ts:15:22
admin-dashboard:build: Type error: Type 'Iterable<FromType>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
admin-dashboard:build:
admin-dashboard:build: 13 | const promises: Promise<ToType>[] = [];
admin-dashboard:build: 14 | let index = 0;
admin-dashboard:build: > 15 | for (const item of await list) {
admin-dashboard:build: | ^
admin-dashboard:build: 16 | promises.push(asyncTransform(item, index));
admin-dashboard:build: 17 | index += 1;
admin-dashboard:build: 18 | }
flimmer git:(main) ✗ npx turbo run build --filter=admin-dashboard
• Packages in scope: admin-dashboard
• Running build in 1 packages
• Remote caching disabled
admin-dashboard:build: cache miss, executing 19cd75ee5e61ff3f
admin-dashboard:build:
yarn run v1.22.21
$ next build
admin-dashboard:build: ▲ Next.js 14.1.3
admin-dashboard:build: - Environments: .env.production
admin-dashboard:build:
admin-dashboard:build: Creating an optimized production build ...
admin-dashboard:build: ✓ Compiled successfully
Linting and checking validity of types ...ESLint: Failed to load config "@repo/eslint-config/library.js" to extend from. Referenced from: /Users/oscdot/Repos/flimmer/.eslintrc.js
Linting and checking validity of types ...Failed to compile.
admin-dashboard:build:
admin-dashboard:build: ../../node_modules/convex-helpers/index.ts:15:22
admin-dashboard:build: Type error: Type 'Iterable<FromType>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
admin-dashboard:build:
admin-dashboard:build: 13 | const promises: Promise<ToType>[] = [];
admin-dashboard:build: 14 | let index = 0;
admin-dashboard:build: > 15 | for (const item of await list) {
admin-dashboard:build: | ^
admin-dashboard:build: 16 | promises.push(asyncTransform(item, index));
admin-dashboard:build: 17 | index += 1;
admin-dashboard:build: 18 | }
Can anyone guide me in the right direction here?
10 Replies
ballingt
ballingt12mo ago
Sounds a bit like https://discord.com/channels/1019350475847499849/1216803200150012132/1216803200150012132 It looks like the way that convex-helpers are compiled, in particular https://www.unpkg.com/browse/convex-helpers@0.1.25/dist/index.js, uses fancier syntax than TypeScript as configured in this project is happy with. There could be a library change here where it's compiled to lower-level syntax, or you could change your tsconfig.json to allow this. @oscklm What's your tsconfig.json look like? Not the one in the convex directory, the one in the project root.
oscklm
oscklmOP12mo ago
Ahh okay!
// ./tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"target": "ES2015",
"downlevelIteration": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@db-service/*": ["packages/db-service/src/*"]
}
},
"include": ["packages/**/*"],
"exclude": ["node_modules", "packages/**/node_modules"]
}
// ./tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"strict": true,
"target": "ES2015",
"downlevelIteration": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@db-service/*": ["packages/db-service/src/*"]
}
},
"include": ["packages/**/*"],
"exclude": ["node_modules", "packages/**/node_modules"]
}
Thanks for the quick response, tryna get the project pushed up on vercel right now for my colleague to use haha, so it's appriciated
ballingt
ballingt12mo ago
the error says
with a '--target' of 'es2015' or higher.
and your target is "ES2015", so it seems like there's typechecking going on that doesn't use this tsconfig.json. also you've got "downlevelIteration": true, right there
ballingt
ballingt12mo ago
@oscklm to quickly unblock you could make TYpeScript errors not block the build https://nextjs.org/docs/pages/api-reference/next-config-js/typescript
next.config.js Options: typescript | Next.js
Next.js reports TypeScript errors by default. Learn to opt-out of this behavior here.
oscklm
oscklmOP12mo ago
I have individual tsconfigs in each app:
// /apps/next-app
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2015",
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"downlevelIteration": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
// /apps/next-app
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2015",
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"downlevelIteration": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
ballingt
ballingt12mo ago
We're doing a pass on convex-helpers patterns soon, so the convex-helpers side of this may be resolved soon — but there's something interesting about Next here where it typechecks using a different config than the one provided
oscklm
oscklmOP12mo ago
Maybe that's the issue. But i'll try the quick unblock fix for now
ballingt
ballingt12mo ago
I'd love to understand what tsconfig.json settings are being used for this typecheck that's blocking your build since that error message doesn't make sense given the settings of either of the tsconfig.json files you've shown
oscklm
oscklmOP12mo ago
I'm glad i'm not the only one thinking it doesn't make sense. Yeah right. To be fair i'm not even using next in my personal projects anymore. Just vite, react and tanstack router. Next is really being a pain in the butt as of late i would say. Unfortunately no way around next for this project for the time being. I wouldn't mind adding you to the full repo, in case you wanna take a look. but at the same time def, don't wanna steal your time. I'm assuming this aint really that convex related anyways. But give me a shout and i will. Alright, seem's to have been the moduleResolution, was set to node. Changed it to bundler, and now it works. I might have actullay changed that to node at one point, since it solves some issues i was having with intellisense, but seems those are gone too even changing it back to bundler.
ballingt
ballingt12mo ago
Was offline for a bit or would have responded, that's great to hear — thanks for tracking this down.

Did you find this page helpful?