diff --git a/package.json b/package.json index 6c868535..b8c246f6 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@macrostrat/revision-info-webpack": "^1.0.0", "@macrostrat/storybook": "workspace:*", "@mdx-js/rollup": "^2.3.0", - "@types/esprima": "^4", "@types/underscore": "^1", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", diff --git a/src/declaration.d.ts b/src/declaration.d.ts index a87d08a3..bf7d239f 100644 --- a/src/declaration.d.ts +++ b/src/declaration.d.ts @@ -1,21 +1,57 @@ // declaration.d.ts -import type { Hyper } from "@macrostrat/hyper"; import type { Component, ReactNode, ReactElement } from "react"; +type Children = ReactNode | ReactNode[]; + +declare module "@macrostrat/hyper" { + interface Hyper { + // Function with one or two arguments + (componentOrTag: Component, children?: Children): ReactNode; + + // Function with three arguments, with one being props +
( + componentOrTag: Component
,
+ props: P,
+ children?: Children
+ ): ReactNode;
+
+ // Function with one list of elements -> React fragment
+ (children?: ReactNode[]): ReactNode[];
+ }
+}
+
+import { Hyper } from "@macrostrat/hyper";
+
// Favicon etc.
declare module "*.png" {
const value: string;
export default value;
}
-// Union of hyper and record
-type StyledHyper = Hyper & Record (
- componentOrTag: Component ,
- props: P,
- children?: ReactElement
- ): Children;
- // Function with one list of elements -> React fragment
- (children?: ReactNode[]): ReactElement;
- }
-}