diff --git a/src/declaration.d.ts b/src/declaration.d.ts index eab49ede..5086da82 100644 --- a/src/declaration.d.ts +++ b/src/declaration.d.ts @@ -1,6 +1,7 @@ // declaration.d.ts import type { Hyper } from "@macrostrat/hyper"; +import type { Component, ReactNode, ReactElement } from "react"; // Union of hyper and record type StyledHyper = Hyper & Record; @@ -26,3 +27,20 @@ declare module "*.module.sass" { const classes: { [key: string]: string }; export default classes; } + +type Children = ReactNode | ReactNode[]; + +declare module "@macrostrat/hyper" { + export interface Hyper { + // Function with one or two arguments + (componentOrTag: Component, children?: Children): Children; + // Function with three arguments, with one being props +

( + componentOrTag: Component

, + props: P, + children?: ReactElement + ): Children; + // Function with one list of elements -> React fragment + (children?: ReactNode[]): ReactElement; + } +}