Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

277
Visualizações
Element implicitly has an 'any' type because expression of type 'any' can't be used to index type in nodejs and solidity

i need set networks in my contract . i use the nodejs and type script .

i wrote this code :

    let networkId: any = await global.web3.eth.net.getId();
    let tetherData = await Tether.networks[networkId];

but it show me this error :

Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'.ts(7053)

now how can i solve the problem ?

this is json file of my contract

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

let networkId: number = await global.web3.eth.net.getId();
let tetherData = await Tether.networks[(networkId as number)];

Why:

getId(callback?: (error: Error, id: number) => void): Promise<number>;
                                                              ^^^^^^

https://github.com/ChainSafe/web3.js/blob/ed1011438c3a7e35da8390998f6d1cb9b34db014/packages/web3-core/types/index.d.ts#L253

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda