Hello everyone,
I recently upgraded to the merged @concordium/web-sdk
from the previously separated common and nodejs SDKs. The process was generally smooth, but I’ve encountered a couple of issues that I hope to get some insight on:
- TypeScript Import Issue: When I try to use
import { ConcordiumGRPCNodeClient, credentials } from '@concordium/web-sdk/nodejs';
TypeScript highlights the from '...'
part, mentioning it’s ECMAScript and suggests using “import” differently. I’m a bit puzzled by this since it seems to be a standard ES6 import.
- Exports: It appears
BlockItem
isn’t exported anymore, even though it’s declared as exported in the types. Specifically, the export in deserialization.d.ts
doesn’t seem to produce the expected effect. I believe it’s essential to have BlockItem
exported for strict type checking and efficient data management, as I strongly use decodeTransaction and have to detect their kind.
Thank you in advance for the help.
Hi there @Federico
-
Did you set "type": "module"
in package.json
? If this is not a fix or not possible can you provide a bit more information of your project setup like:
a. What is the exact error?
b. Are you using a bundler?
c. What tsconfig target
and module
do you use?
-
You are right, this should be exported, thank you for bringing this to our attention. Until this is fixed and released, you can get access to the type like this:
import {deserializeTransaction} from '@concordium/web-sdk';
type BlockItem = ReturnType<typeof deserializeTransaction>;
thank you.
moreover, getAlias isn’t anymore recognized as exported, do you agree on this?
> tsc --build && ts-node index.ts
components/concordium.ts:4:26 - error TS2305: Module '"@concordium/web-sdk"' has no exported member 'getAlias'.
4 import { AccountAddress, getAlias } from '@concordium/web-sdk'
This was moved to AccountAddress.getAlias
The BlockItem
type is exported again in @concordium/web-sdk@7.0.1
.