ensdomains / ensjs

ENS javascript library for contract interaction
MIT License
123 stars 56 forks source link

Fix types for ENSInstance.batch #52

Closed kliyer-ai closed 1 year ago

kliyer-ai commented 2 years ago

The return type after awaiting the promise is any[] | undefined. Any chance that could be adjusted to reflect the real return type of the batched functions? Thanks!

Example below. Check the type of res.

import { ENS } from '@ensdomains/ensjs'
import { providers } from 'ethers'

const provider = new providers.AlchemyProvider(1, process.env.ALCHEMY_KEY)
const ENSInstance = new ENS()
await ENSInstance.setProvider(provider)

const res = await ENSInstance.batch(
  ENSInstance.getName.batch('0x0000000000000000000000000000000000000000')
)