Error in daml.js I don't understand

The following error shows up when using the useStreamQueries react hook filtering for a specific template.

We’ve tried regenerating the js code, deleting node_modules and package-lock.json, to no avail.

The same error appears with node 14, 16, and 18.

Below is an excerpt of the error message.

Does anyone have a pointer how to fix it?

TypeError: damlTypes.assembleInterface is not a function
(anonymous function)
   12 | /* eslint-disable-next-line no-unused-vars */
   13 | var damlLedger = require('@daml/ledger');
   14 | 
 > 15 | exports.AttestationToken = damlTypes.assembleInterface(
   16 |   '7eaaf2a2b6b23cf6c97b6f34c594be8df67e04cba09f6364cfdc347e2ed9c260:DA.Interfaces.Attestation.AttestationToken:AttestationToken',
   17 |   function () { return exports.View; },
   18 |   {

Can you check your version of daml-types that you specified in package.json? Maybe even share your package-lock.json?

Indeed, this almost certainly indicates that your @daml/types dependency is too old for the codegen version you’re using now.