hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
17 lines • 848 B
JavaScript
/**
* Builds a utils task from a configured task builder and a lazily-loaded action.
*
* The standard builder's `setAction`/`build` are hardcoded to
* `NewTaskActionFunction`, so it can't produce a `NewUtilsTaskDefinition` on its
* own. This helper requires the action to be a `NewUtilsTaskActionFunction`
* (rejecting wider actions at the call site), which is what makes re-narrowing
* the built definition sound.
*/
export function buildUtilsTask(builder, action) {
// The narrower action is assignable to the builder's `NewTaskActionFunction`,
// and since `action` is statically a `NewUtilsTaskActionFunction`, re-narrowing
// the result is safe.
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- see above
return builder.setAction(action).build();
}
//# sourceMappingURL=utils-task.js.map