Cannot find module '@types/tronweb' or its corresponding type declarations.
The project looks broken.
According to the package.json
...
"license": "MIT",
"main": "index.js",
"name": "@daochild/tronweb-typescript",
...
there are no types defined and main file is index.js which doesn't exist in the package:
Look at the @types/uuid as a simple example how it should be done:
...
"license": "MIT",
"main": "",
"name": "@types/uuid",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/uuid"
},
"scripts": {},
"typeScriptVersion": "3.8",
"types": "index.d.ts",
...
It was tested on node.js 16 and using with Goland IDE, types have been displayed.
Same issue too, how can i fix it @daochild ?
Same issue too, how can i fix it @daochild ?
Attempt check the next code example, maybe it will be helpful https://github.com/daochild/tronweb-typescript/blob/main/src/tests/test.ts#L9
And let me know if it not.
I tried but not working
@uuhnaut69 @altbit Hi it should have been fixed for now. Could you check please?
Not working, can not reference to tronweb type
Hello, I had the same issue. Fixed it by adding @daochild/tronweb-typescript to the types section in tsconfig.json as following:
"types": [
"@daochild/tronweb-typescript"
],
My package.json:
{
"devDependencies": {
"@daochild/tronweb-typescript": "^1.1.2",
"typescript": "^5.3.3"
},
"dependencies": {
"tronweb": "^5.3.1"
}
}
Also, now there is no need for tripple-slash reference. I think there is a better way, but I couldn't find one.
same issue but it doesn't work for me.
installed @daochild/tronweb-typescript and added it to type section in tsconfig.json.
double checked package.json file too.
please let me know what i should do.
the solution is to add to tsconfig.json
"include": [
"src",
"./node_modules/@daochild/tronweb-typescript/dist/index.d.ts"
],
Update to v1.2.2 Read Usage in README.md
Still not working in my side.
I'm using node v20.16.0.
I already built tronweb script in node.js but can't convert to typescript.
/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:859 return new TSError(diagnosticText, diagnosticCodes, diagnostics); ^ TSError: ⨯ Unable to compile TypeScript: swap_last.ts:2:21 - error TS7016: Could not find a declaration file for module 'tronweb'. '/root/dev/Tron-volume-script/node_modules/tronweb/dist/TronWeb.node.js' implicitly has an 'any' type. Try npm i --save-dev @types/tronwebif it exists or add a new declaration (.d.ts) file containingdeclare module 'tronweb';`
2 import TronWeb from 'tronweb'; ~~~~~~~~~ swap_last.ts:23:75 - error TS7006: Parameter 'error' implicitly has an 'any' type.
23 const tx = await tronWeb.trx.sendTransaction(toAddress, amount).catch(error => { ~~~~~
at createTSError (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:859:12)
at reportTSError (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:863:19)
at getOutput (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1077:36)
at Object.compile (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1433:41)
at Module.m._compile (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1617:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Object.require.extensions.<computed> [as .ts] (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Function.Module._load (node:internal/modules/cjs/loader:1024:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
diagnosticCodes: [ 7016, 7006 ] }`
This is error. I followed the readme but not working in my side. How can I solve this?
Still not working in my side. I'm using node v20.16.0. I already built tronweb script in node.js but can't convert to typescript.
/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:859 return new TSError(diagnosticText, diagnosticCodes, diagnostics); ^ TSError: ⨯ Unable to compile TypeScript: swap_last.ts:2:21 - error TS7016: Could not find a declaration file for module 'tronweb'. '/root/dev/Tron-volume-script/node_modules/tronweb/dist/TronWeb.node.js' implicitly has an 'any' type. Trynpm i --save-dev @types/tronwebif it exists or add a new declaration (.d.ts) file containingdeclare module 'tronweb';`2 import TronWeb from 'tronweb'; ~~~~~~~~~ swap_last.ts:23:75 - error TS7006: Parameter 'error' implicitly has an 'any' type.
23 const tx = await tronWeb.trx.sendTransaction(toAddress, amount).catch(error => { ~~~~~
at createTSError (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:859:12) at reportTSError (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:863:19) at getOutput (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1077:36) at Object.compile (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1433:41) at Module.m._compile (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1617:30) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Object.require.extensions.<computed> [as .ts] (/root/.nvm/versions/node/v20.16.0/lib/node_modules/ts-node/src/index.ts:1621:12) at Module.load (node:internal/modules/cjs/loader:1208:32) at Function.Module._load (node:internal/modules/cjs/loader:1024:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {diagnosticCodes: [ 7016, 7006 ] }`
This is error. I followed the readme but not working in my side. How can I solve this?
It doesn't work only with this method or with any other? Try add custom type as in read me. Or resolve implicity types in tsconfig.
Cool. Thanks for your support. I hope your business will be success. Best regards.