Skip to content

WOQL.vars and WOQL.Vars cannot be used with WOQL.read_document without @ts-ignore in 12.0.5 #378

Description

@wcoolidge

Describe the bug
WOQL.read_document requires string arguments, not WOQL.var or WOQ.Var defined variables.
This is inconsistent with the other WOQL query functions, documentation, and requires the use of @ts-ignore as a work around.

To Reproduce
this is a compile time bug (do not know how to make a test for a compile time issue) that is also visible in visual studio as well as being a compile time error.

This is evident in the type signature of read_document.

This can be seen in the following code snipped in VS Code and in a failed compile:

const [uri, doc] = WOQL.vars('uri', 'doc')
WOQL.read_document(uri, doc)

Expected behavior
it compiles and both styles of terminus.Var (not "v.uri" and "v.doc") can be used in WOQL under typescript without @ts-ignore

Error logs
Argument of type 'Var' is not assignable to parameter of type 'string'.ts(2345) const v: Record<string, terminus.Var>

System information (please complete the following information):

  • OS: ubuntu 22.04
  • node.js 22.22.0
  • terminusdb client 12.0.5
  • terminusdb 12.0.5
  • swi-prolog 10.0.2
  • rustc 1.94.1
  • rush package dependencies:

{
...
"terminusdb": "12.0.5"
},
"devDependencies": {
"@microsoft/api-extractor": "7.54.0",
"@rushstack/eslint-config": "4.4.0",
"@rushstack/heft": "0.74.5",
"@rushstack/heft-jest-plugin": "0.16.14",
"@types/node": "24.5.2",
"eslint": "9.35.0",
"typescript": "5.8.3",
"@rushstack/heft-typescript-plugin": "0.9.14",
"@rushstack/heft-lint-plugin": "0.7.6",
"@rushstack/heft-api-extractor-plugin": "0.4.13",
"@types/heft-jest": "~1.0.6"
}

tsconfig:

{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"outDir": "../../../../lib",
"rootDir": "../../../../src",
"allowJs": true,
"checkJs" : true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strict": true,
"useUnknownInCatchVariables": false,
"esModuleInterop": true,
"noEmitOnError": false,
"allowUnreachableCode": false,
"preserveSymlinks": true,
"noEmit": false,
"pretty": true,
"strictNullChecks": true,
"noUnusedParameters": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"skipLibCheck": true,
"strictPropertyInitialization": false,
"useDefineForClassFields": true,
"typeRoots": ["./node_modules/terminusdb/dist/typescript", "../../../../node_modules/@types", "../../node_modules/@types"],
"allowSyntheticDefaultImports" : true,
"lib": [
"es2024",
"ESNext.Array",
"ESNext.Collection",
"ESNext.Iterator"
],
"module": "nodenext",
"target": "es2024",
"moduleResolution": "node16",
"incremental": true,
"resolveJsonModule": true
},
"include": ["../../../../src//*.ts", "../../../../src//.js", "../../../../src/**/.tsx", "./node_modules/terminusdb/dist/typescript/index.d.ts"]
}

Additional context

Add any other context about the problem here

this appears to be a regression

work-around is to use @ts-ignore

I had hoped it was an issue with the path changes due to the terminusdb client name change in the tsconfig typeRoots and include paths (but no). In upgrading to 12.0.5 I did not think to reflect the path change in tsconfig, It may make sense to add a migration section in the doc to cover all failure cases :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageissue to be triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions