Skip to content

Commit

Permalink
Fix up types.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Feb 19, 2024
1 parent 586dfcf commit d238558
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
3 changes: 3 additions & 0 deletions packages/remdx/client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ declare module '*.re.mdx' {

export let Components: import('./types.jsx').MDXComponents | undefined;
export let Themes: import('./types.jsx').Themes | undefined;
export let Transitions:
| Record<string, import('./types.jsx').SlideTransition>
| undefined;
export default slides;
}
3 changes: 3 additions & 0 deletions packages/remdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
},
"scripts": {
"build": "rm -f index.js; esbuild --format=esm --outfile=index.js --jsx=automatic --external:react --external:react-dom --bundle ./index.tsx"
},
"dependencies": {
"@types/mdx": "^2.0.11"
}
}
33 changes: 3 additions & 30 deletions packages/remdx/types.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,8 @@
import type { MDXComponents as _MDXComponents } from 'mdx/types.js';
import { CSSProperties } from 'react';

/**
* Configuration for `MDXProvider`.
*/
type MDXProps = {
/**
* Children (optional).
*/
children?: ReactNode | null | undefined;
/**
* Additional components to use or a function that creates them (optional).
*/
components?: Readonly<MDXComponents> | MergeComponents | null | undefined;
/**
* Turn off outer component context (default: `false`).
*/
disableParentContext?: boolean | null | undefined;
};

/**
* Provider for MDX context.
*
* @param {Readonly<MDXProps>} properties
* Properties.
* @returns {JSX.Element}
* Element.
* @satisfies {Component}
*/
function MDXProvider(properties: Readonly<MDXProps>): JSX.Element;
export type MDXComponents = _MDXComponents;

export type MDXComponents = MDXProps['components'];
export type Themes = Record<string, CSSProperties>;

export type SlideTransition = {
Expand All @@ -44,7 +17,7 @@ export type ReMDXSlide = {
};

export type ReMDXModule = {
Components?: MDXComponents;
Components?: _MDXComponents;
Themes?: Themes;
Transitions?: Record<string, SlideTransition>;
default: ReadonlyArray<ReMDXSlide>;
Expand Down
4 changes: 4 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d238558

Please sign in to comment.