🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
Node JS typescript compiler not liking Solace API reference to 'long'
I'm running into this error when I try to run my TS compiler:
node_modules/solclientjs/index.d.ts:2:10 - error TS2616: 'Long' can only be imported by using 'import Long = require("long")' or a default import. 2 import { Long } from "long"; ~~~~ node_modules/solclientjs/index.d.ts:2:22 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
I've tried following the suggestion of toggling the 'esModuleInterop' flag, but it appears like the solclientjs module is simply referencing the 'long' package incorrectly. Any advice for fixing (good) or getting around (not as good) this error?
Thanks in advance. I'm sure this is in the wrong place, but I was only given two wrong categories to post into.
Answers
-
I also encountered this and the problem is that "@types/long" is specified in "devDependencies" in package.json of solclientjs v10.10.0.
"devDependencies" are only installed when you run "npm install" while developing solclientjs, not when you install solclientjs as a dependency in another project.
For "@types/long" to be installed together with solclientjs in users projects it must be specified in "dependencies".
This problem was solved for me after I added "@types/long" as a dependency alongside solclientjs in my project.
0 -
I got another update from the team - seems there was a bit of confusion.
The changes that will be in the next release re: type definitions will address the following (and this will be in the release notes):
JavaScript type definitions: -SDTMapContainer is missing the method `addField` -Session type definition is too restrictive -Message type definition is too restrictive -MessageConsumer#disposed should be changed to boolean -MessageConsumerProperties#queueProperties and SessionProperties#publisherProperties` should be changed to optional
However, we can't fix the specific issue mentioned in this thread until it is resolved in the underlying library here: https://github.com/dcodeIO/long.js/issues/109
1