virgil-e3kit-js
virgil-e3kit-js copied to clipboard
export { KeyPairType } from 'virgil-crypto/dist/node.es.js' is a ANY type
Describe the bug
TSC error when trying to compile for deployment using node v18.18.2.
node_modules/@virgilsecurity/e3kit-node/dist/types/src/index.d.ts:2:29 - error TS7016: Could not find a declaration file for module 'virgil-crypto/dist/node.es.js'.
Package dependencies
"@virgilsecurity/e3kit-node": "^3.0.5",
"virgil-crypto": "^5.1.1",
"virgil-sdk": "^6.2.0",
"typescript": "^5.3.3"
Looks like the KeyPairType exported has a any
type and is making TSC complain.
Expected behavior
Expect KeyPairType
export to have type.
Screenshots
> tsc
node_modules/@virgilsecurity/e3kit-node/dist/types/src/index.d.ts:2:29 - error TS7016: Could not find a declaration file for module 'virgil-crypto/dist/node.es.js'. '/Users/admin/app/functions/node_modules/virgil-crypto/dist/node.es.js' implicitly has an 'any' type.
If the 'virgil-crypto' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'virgil-crypto/dist/node.es.js';`
2 export { KeyPairType } from 'virgil-crypto/dist/node.es.js';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/@virgilsecurity/e3kit-node/dist/types/src/index.d.ts:2
@chinesehemp Hello! Sorry for being late, you do not need to import KyPairType from /dist/node.es.js
This will work, because .es files working not like modules!
import { KeyPairType } from 'virgil-crypto';
@chinesehemp Hello! Sorry for being late, you do not need to import KyPairType from /dist/node.es.js This will work, because .es files working not like modules!
import { KeyPairType } from 'virgil-crypto';
Hi @rstp-god thanks for getting back to me. I'm not trying to import KeyPairType from virgil-crypto. Maybe I didn't word it correctly. The issue is Typescript compiler is warning me of an error and I traced it back to the source where the type had the any value.
> tsc
node_modules/@virgilsecurity/e3kit-node/dist/types/src/index.d.ts:2:29 - error TS7016: Could not find a declaration file for module 'virgil-crypto/dist/node.es.js'. '/Users/admin/app/functions/node_modules/virgil-crypto/dist/node.es.js' implicitly has an 'any' type.
If the 'virgil-crypto' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'virgil-crypto/dist/node.es.js';`
2 export { KeyPairType } from 'virgil-crypto/dist/node.es.js';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/@virgilsecurity/e3kit-node/dist/types/src/index.d.ts:2