Skip to content

Commit

Permalink
remove Prettify and use Simplify from type-fest
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Oct 31, 2023
1 parent 0a6d818 commit 4204509
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions packages/nextjs/utils/scaffold-eth/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ExtractAbiFunction,
} from "abitype";
import type { ExtractAbiFunctionNames } from "abitype";
import type { Simplify } from "type-fest";
import {
Address,
Block,
Expand All @@ -22,16 +23,6 @@ import deployedContractsData from "~~/generated/deployedContracts";
import externalContractsData from "~~/generated/externalContracts";
import scaffoldConfig from "~~/scaffold.config";

/**
* @description Combines members of an intersection into a readable type.
* @example
* Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
* => { a: string, b: string, c: number, d: bigint }
*/
type Prettify<T> = {
[K in keyof T]: T[K];
} & unknown;

export type GenericContractsDeclaration = {
[chainId: number]: {
[contractName: string]: {
Expand Down Expand Up @@ -169,7 +160,7 @@ export type UseScaffoldEventConfig<
} & IsContractDeclarationMissing<
Omit<UseContractEventConfig, "listener"> & {
listener: (
logs: Prettify<
logs: Simplify<
Omit<Log<bigint, number, any>, "args" | "eventName"> & {
args: Record<string, unknown>;
eventName: string;
Expand All @@ -179,7 +170,7 @@ export type UseScaffoldEventConfig<
},
Omit<UseContractEventConfig<ContractAbi<TContractName>, TEventName>, "listener"> & {
listener: (
logs: Prettify<
logs: Simplify<
Omit<Log<bigint, number, false, TEvent, false, [TEvent], TEventName>, "args"> & {
args: AbiParametersToPrimitiveTypes<TEvent["inputs"]> &
GetEventArgs<
Expand Down

0 comments on commit 4204509

Please sign in to comment.