-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
index.d.ts
71 lines (62 loc) · 1.41 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// TypeScript Version: 3.4
import {
Context,
Consumer,
ComponentType,
FunctionComponent,
ReactElement,
createElement
} from 'react'
/**
* Mapping of names for JSX components to React components
*/
interface ComponentDictionary {
[name: string]: ComponentType<any>
}
/**
* Prop type that includes a component dictionary
*/
interface ComponentsProp {
/**
* Mapping of names for JSX components to React components
*/
components: ComponentDictionary
}
/**
* Direct access to the MDX React Context
*/
declare const MDXContext: Context<ComponentsProp>
/**
* Provider for MDX context
*/
declare const MDXProvider: FunctionComponent<ComponentsProp>
/**
* Gets components from the MDX Context
*
* @param components additional components to include
* @returns all components from context with overrides from components parameter
*/
declare function useMDXComponents(
components: ComponentDictionary | (() => ComponentDictionary)
): ComponentDictionary
/**
* High order component that passes components prop to child
*
* @param child Component being wrapped
*/
declare function withMDXComponents(
child: ComponentType<ComponentsProp>
): ReactElement | null
/**
* React createElement function wrapped with handler for MDX content
*/
declare const mdx: typeof createElement
export {
ComponentDictionary,
ComponentsProp,
MDXContext,
MDXProvider,
useMDXComponents,
withMDXComponents,
mdx
}