Skip to content

Commit

Permalink
Somewhat improved styles for hyperscript
Browse files Browse the repository at this point in the history
  • Loading branch information
davenquinn committed Jul 21, 2024
1 parent ac03069 commit 4d109ce
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/declaration.d.ts
Original file line number Diff line number Diff line change
@@ -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<string, string>;
Expand All @@ -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
<P = {}>(
componentOrTag: Component<P>,
props: P,
children?: ReactElement
): Children;
// Function with one list of elements -> React fragment
(children?: ReactNode[]): ReactElement;
}
}

0 comments on commit 4d109ce

Please sign in to comment.