-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Currently, the main lookup method is configured to accept a series of params:
async lookup(ip?: string, selectField?: string, fields?: string[])The issue is if you are wanting to set only one of these, you need to pass undefined to the preceding params.
A common pattern to help solve this scenario would be:
export interface LookupParams {
ip?: string
selectField?: string
fields?: string[]
}
// ... main class
{
async lookup({ ip, selectField, fields }: LookupParams = {}) {
// ... lookup logic
}
}Naturally, changing the shape of the method signature is a tricky undertaking, so potentially you could run a type check on the first param and keep the existing ones to allow backward compatibility?
Metadata
Metadata
Assignees
Labels
No labels