Exported variable 'fooQuery' has or is using name 'typenameSymbol' from external module but cannot be named
Code I'm trying to define a function that generates a query, such as:
export const caseQuery = (issueId: string) =>
e.select(e.issue.Issue, () => ({
id: true,
openedAt: true,
closedAt: true,
title: true,
documents: document => ({
id: true,
name: true,
createdAt: true,
participant: true,
dataType: true,
order_by: document.createdAt,
}),
filter_single: { id: issueId },
}));
This previously seemed to work just fine with edgedb version 1.5.3, but breaks after updating to 2.0.1. I believe this PR is the culprit, as it adds the mentioned typenameSymbol stuff.
The error is as follows:
Exported variable 'caseQuery' has or is using name 'typenameSymbol' from external module "/workspace/src/ts/packages/gel/src/edgeql/path" but cannot be named. ts(4023)
(where packages/gel/src/edgeql is the codegen folder from edgedb generate edgeql-js).
The issue appears to pop up specifically when using the nested subquery for documents (or any subquery like that) - the error disappears after removing that field.
Schema
Too big to list here.
Generated EdgeQL
N/A
Error or desired behavior
Versions (please complete the following information):
- EdgeDB version: 5.6
gel-jsversion: 2.0.1@gel/generateversion: 0.6.2- TypeScript version: 5.5
This is probably related to some tsconfig.json option on your side being different than the config we use and test. Can you provide some insight into your setup so we can see what the breakage is?
Ours looks something like this (some pieces removed that didn't seem relevant, like paths and plugins).
{
"include": [],
"files": [],
"exclude": [
"**/jest.*",
"**/node_modules/**/*",
"**/dist/**/*",
"**/types/**/*",
"**/*.spec.ts",
"**/*.spec.tsx"
],
"compilerOptions": {
"noErrorTruncation": true,
"target": "esnext",
"module": "commonjs",
"moduleResolution": "node",
"jsx": "react-jsx",
"lib": ["esnext", "dom", "dom.iterable"],
"types": ["node"],
"typeRoots": ["node_modules/@types"],
"baseUrl": ".",
"rootDir": ".",
"composite": true,
"strict": true,
"allowJs": true,
"checkJs": false,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"importHelpers": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"noEmitHelpers": true,
"noImplicitAny": true,
"noImplicitReturns": false,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveConstEnums": true,
"removeComments": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"strictNullChecks": true,
"useUnknownInCatchVariables": false,
"experimentalDecorators": true
}
}
It does seem to be something specific to the nested subquery for documents there - removing that makes the error go away. Also the function piece seems unrelated - moving to a bare query assignment like this also results in the same error:
export const caseQuery = e.select(e.issue.Issue, () => ({
id: true,
openedAt: true,
closedAt: true,
title: true,
documents: document => ({
id: true,
name: true,
createdAt: true,
participant: true,
dataType: true,
order_by: document.createdAt,
}),
filter_single: { id: "" },
}));
Something about it also seems to essentially crash TypeScript - after a while I can no longer save the file without triggering a message like this forever in VSCode, after which point the TypeScript warnings no longer update:
EDIT: OK just removing the order_by also seemed to fix it - this worked without errors:
export const caseQuery = e.select(e.issue.Issue, () => ({
id: true,
openedAt: true,
closedAt: true,
title: true,
documents: () => ({
id: true,
name: true,
createdAt: true,
participant: true,
dataType: true,
}),
filter_single: { id: "" },
}));
Someone from the discord has a temporary fix till this is fixed in the package
I found it in gel-js/packages/generate/src/syntax/path.ts, and locally fixed it by changing:
export const typenameSymbol = Symbol("typename");
As a temporary solution, I’m just importing it where needed:
import { typenameSymbol } from "../edgeql-js/path";