-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
minor-bumpPlanned for the next minor version bump.Planned for the next minor version bump.
Description
The getResolver()
method on the EnsProvider
interface is declared with the following signature
export interface EnsProvider {
getResolver(name: string): Promise<EnsResolver | null>;
}
The implementation of getResolver()
can return null
though
ethers.js/packages/providers/src.ts/base-provider.ts
Lines 1515 to 1524 in 4e93945
async getResolver(name: string): Promise<Resolver> { | |
try { | |
const address = await this._getResolver(name); | |
if (address == null) { return null; } | |
return new Resolver(this, address, name); | |
} catch (error) { | |
if (error.code === Logger.errors.CALL_EXCEPTION) { return null; } | |
return null; | |
} | |
} |
This leads to callers of getResolver()
not anticipating null
as the return value which leads to runtime errors even though type-checking passes. I’d expect the following signature.
export interface EnsProvider {
getResolver(name: string): Promise<EnsResolver | null>;
}
Metadata
Metadata
Assignees
Labels
minor-bumpPlanned for the next minor version bump.Planned for the next minor version bump.