Skip to content

Commit

Permalink
Add proper types for helper props (#3)
Browse files Browse the repository at this point in the history
* Add proper types for helper `props`

* Simplify by utilizing mdx component types

* Add mdx dep since we're specifically importing that in helpers.tsx
  • Loading branch information
isoscelesxyz authored Sep 17, 2024
1 parent a37cc16 commit c3e79e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
6 changes: 2 additions & 4 deletions content/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
*/
import React from "react";

import { MDXProvider } from "@mdx-js/react";
import type { MDXComponents as MDXComponentsType } from "mdx/types";

type Components = Parameters<typeof MDXProvider>[0]["components"];

const MDXComponents: Components = {
const MDXComponents: MDXComponentsType = {
h1: (props) => (
<h1 className="mb-6 text-2xl text-gray-600 dark:text-gray-400" {...props} />
),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"lint": "prettier -c --write ."
},
"devDependencies": {
"@types/mdx": "^2.0.13",
"flowbite-react": "0.4.10",
"islandjs": "^0.7.6",
"prettier": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@
dependencies:
"@types/unist" "^2"

"@types/mdx@^2.0.0":
"@types/mdx@^2.0.0", "@types/mdx@^2.0.13":
version "2.0.13"
resolved "https://registry.yarnpkg.com/@types/mdx/-/mdx-2.0.13.tgz#68f6877043d377092890ff5b298152b0a21671bd"
integrity sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==
Expand Down

0 comments on commit c3e79e8

Please sign in to comment.