5.3.2 • Published 2 years ago
@agrozyme/types-tronweb v5.3.2
types-tronweb
TypeScript definitions for TronWeb
- Include all TronWeb and TronLink types from source code
- convert protobuf definitions to typescript definitions and re-export types with prefix
Tron - TronLink types with prefix
TronLink - only the TronWeb class can use
new TronWebbyimport TronWeb from 'tronweb' - other declare class always use for type hint
- use this package, to create folder
@types/tronwebunder the source folder and put the code inindex.d.ts
declare module 'tronweb' {
export * from '@agrozyme/types-tronweb';
import TronWeb from '@agrozyme/types-tronweb';
export default TronWeb;
}- In browser project, it can manually define the
TronLinkinjected object type
declare global {
interface Window {
tron?: Tron;
tronLink?: TronLink;
tronWeb?: TronWeb;
}
}