RJ
RJ2y ago

Expected identifier but found "const"

I've been upgrading some packages and started seeing this error when running npx convex dev, but not when running tsc --project convex/tsconfig.json:
❯ npx convex dev
⠦ Preparing Convex functions...
✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Either.ts:506:19:
506 │ export const all: <const I extends Iterable<Either<any, any>> | Record<string, Either<any, any>>>(
╵ ~~~~~

✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Option.ts:769:19:
769 │ export const all: <const I extends Iterable<Option<any>> | Record<string, Option<any>>>(
╵ ~~~~~
❯ npx convex dev
⠦ Preparing Convex functions...
✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Either.ts:506:19:
506 │ export const all: <const I extends Iterable<Either<any, any>> | Record<string, Either<any, any>>>(
╵ ~~~~~

✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Option.ts:769:19:
769 │ export const all: <const I extends Iterable<Option<any>> | Record<string, Option<any>>>(
╵ ~~~~~
I don't see this when running the Remix dev server. I can probably do at least a little more troubleshooting on my end, but wanted to know if anyone had any easy hints, suggestions or suspicions just from this information.
9 Replies
Michal Srb
Michal Srb2y ago
Sounds like a TypeScript version mismatch, the const in generics is probably a new TS feature?
RJ
RJOP2y ago
Yeah I figured, I'm on the latest version though I just tested it also with the exact version specified in @effect/data's package.json and got the same error
RJ
RJOP2y ago
That is interesting 😆 Hmm So I guess not all bundlers notice that comment?
ballingt
ballingt2y ago
I think this error is coming from TypeScript, rather that esbuild not being able to bundle this code — could you check by trying --typecheck=disable?
RJ
RJOP2y ago
Am I doing this right?
❯ npx convex dev --typecheck=disable
⠹ Preparing Convex functions...
✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Either.ts:506:19:
506 │ export const all: <const I extends Iterable<Either<any, any>> | Record<string, Either<any, any>>>(
╵ ~~~~~

✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Option.ts:769:19:
769 │ export const all: <const I extends Iterable<Option<any>> | Record<string, Option<any>>>(
╵ ~~~~~
❯ npx convex dev --typecheck=disable
⠹ Preparing Convex functions...
✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Either.ts:506:19:
506 │ export const all: <const I extends Iterable<Either<any, any>> | Record<string, Either<any, any>>>(
╵ ~~~~~

✘ [ERROR] Expected identifier but found "const"

node_modules/@effect/data/src/Option.ts:769:19:
769 │ export const all: <const I extends Iterable<Option<any>> | Record<string, Option<any>>>(
╵ ~~~~~
ballingt
ballingt2y ago
yes! you disproved my theory, perfect OK it's esbuild! support for const type parameters was added in 0.17.5, and we're using "^0.15.16"
RJ
RJOP2y ago
Also
❯ npx tsc --project src/convex/tsconfig.json
❯ npx tsc --project src/convex/tsconfig.json
produces
❯ echo $?
0
❯ echo $?
0
Aha!
ballingt
ballingt2y ago
Sounds like it's time for quick patch release, and more generally we can chew on bundler pluggability eta on this is "after lunch" @RJ esbuild upgrade is out in 1.1.1! This took considerably longer because we found out developers could override the version of esbuild used for convex specifically in package.json, making it less urgent.

Did you find this page helpful?