@types/mdx 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mdx/LICENSE +0 -0
- mdx/README.md +1 -2
- mdx/index.d.ts +16 -24
- mdx/package.json +10 -9
- mdx/types.d.ts +24 -21
mdx/LICENSE
CHANGED
|
File without changes
|
mdx/README.md
CHANGED
|
@@ -8,9 +8,8 @@ This package contains type definitions for mdx (https://github.com/mdx-js/mdx).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdx.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Wed, 18 Oct 2023 18:04:03 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
|
-
* Global values: none
|
|
14
13
|
|
|
15
14
|
# Credits
|
|
16
15
|
These definitions were written by [Christian Murphy](https://github.com/ChristianMurphy), [Remco Haszing](https://github.com/remcohaszing), and [Titus Wormer](https://github.com/wooorm).
|
mdx/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
// Type definitions for non-npm package mdx 2.0
|
|
2
|
-
// Project: https://github.com/mdx-js/mdx
|
|
3
|
-
// Definitions by: Christian Murphy <https://github.com/ChristianMurphy>
|
|
4
|
-
// Remco Haszing <https://github.com/remcohaszing>
|
|
5
|
-
// Titus Wormer <https://github.com/wooorm>
|
|
6
|
-
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
|
-
// TypeScript Version: 3.9
|
|
8
|
-
|
|
9
1
|
/**
|
|
10
2
|
* An MDX file which exports a JSX component.
|
|
11
3
|
*
|
|
@@ -58,9 +50,9 @@
|
|
|
58
50
|
*
|
|
59
51
|
* It should now be possible to import both the MDX component and the exported constant `message`.
|
|
60
52
|
*/
|
|
61
|
-
declare module
|
|
53
|
+
declare module "*.mdx" {
|
|
62
54
|
// eslint-disable-next-line @definitelytyped/no-self-import
|
|
63
|
-
import { MDXProps } from
|
|
55
|
+
import { MDXProps } from "mdx/types";
|
|
64
56
|
|
|
65
57
|
/**
|
|
66
58
|
* An function component which renders the MDX content using JSX.
|
|
@@ -78,48 +70,48 @@ declare module '*.mdx' {
|
|
|
78
70
|
/**
|
|
79
71
|
* A markdown file which exports a JSX component.
|
|
80
72
|
*/
|
|
81
|
-
declare module
|
|
82
|
-
export { default } from
|
|
73
|
+
declare module "*.md" {
|
|
74
|
+
export { default } from "*.mdx";
|
|
83
75
|
}
|
|
84
76
|
|
|
85
77
|
/**
|
|
86
78
|
* A markdown file which exports a JSX component.
|
|
87
79
|
*/
|
|
88
|
-
declare module
|
|
89
|
-
export { default } from
|
|
80
|
+
declare module "*.markdown" {
|
|
81
|
+
export { default } from "*.mdx";
|
|
90
82
|
}
|
|
91
83
|
|
|
92
84
|
/**
|
|
93
85
|
* A markdown file which exports a JSX component.
|
|
94
86
|
*/
|
|
95
|
-
declare module
|
|
96
|
-
export { default } from
|
|
87
|
+
declare module "*.mdown" {
|
|
88
|
+
export { default } from "*.mdx";
|
|
97
89
|
}
|
|
98
90
|
|
|
99
91
|
/**
|
|
100
92
|
* A markdown file which exports a JSX component.
|
|
101
93
|
*/
|
|
102
|
-
declare module
|
|
103
|
-
export { default } from
|
|
94
|
+
declare module "*.mkdn" {
|
|
95
|
+
export { default } from "*.mdx";
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
/**
|
|
107
99
|
* A markdown file which exports a JSX component.
|
|
108
100
|
*/
|
|
109
|
-
declare module
|
|
110
|
-
export { default } from
|
|
101
|
+
declare module "*.mkd" {
|
|
102
|
+
export { default } from "*.mdx";
|
|
111
103
|
}
|
|
112
104
|
|
|
113
105
|
/**
|
|
114
106
|
* A markdown file which exports a JSX component.
|
|
115
107
|
*/
|
|
116
|
-
declare module
|
|
117
|
-
export { default } from
|
|
108
|
+
declare module "*.mkdown" {
|
|
109
|
+
export { default } from "*.mdx";
|
|
118
110
|
}
|
|
119
111
|
|
|
120
112
|
/**
|
|
121
113
|
* A markdown file which exports a JSX component.
|
|
122
114
|
*/
|
|
123
|
-
declare module
|
|
124
|
-
export { default } from
|
|
115
|
+
declare module "*.ron" {
|
|
116
|
+
export { default } from "*.mdx";
|
|
125
117
|
}
|
mdx/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/mdx",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "TypeScript definitions for mdx",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdx",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"contributors": [
|
|
8
8
|
{
|
|
9
9
|
"name": "Christian Murphy",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"githubUsername": "ChristianMurphy",
|
|
11
|
+
"url": "https://github.com/ChristianMurphy"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "Remco Haszing",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"githubUsername": "remcohaszing",
|
|
16
|
+
"url": "https://github.com/remcohaszing"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "Titus Wormer",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"githubUsername": "wooorm",
|
|
21
|
+
"url": "https://github.com/wooorm"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
24
|
"main": "",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {},
|
|
32
32
|
"dependencies": {},
|
|
33
|
-
"typesPublisherContentHash": "
|
|
34
|
-
"typeScriptVersion": "4.
|
|
33
|
+
"typesPublisherContentHash": "ebc76ef7a1f8a1d936385475bfbfab5398fb4fe4f29ac08892daec8ed9a8075d",
|
|
34
|
+
"typeScriptVersion": "4.5",
|
|
35
|
+
"nonNpm": true
|
|
35
36
|
}
|
mdx/types.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ type FunctionElementType = Extract<ElementType, (props: Record<string, any>) =>
|
|
|
15
15
|
/**
|
|
16
16
|
* This matches any class component types that ar part of `ElementType`.
|
|
17
17
|
*/
|
|
18
|
-
type ClassElementType = Extract<ElementType, new
|
|
18
|
+
type ClassElementType = Extract<ElementType, new(props: Record<string, any>) => any>;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A valid JSX string component.
|
|
@@ -26,25 +26,25 @@ type StringComponent = Extract<keyof JSX.IntrinsicElements, ElementType extends
|
|
|
26
26
|
* A valid JSX function component.
|
|
27
27
|
*/
|
|
28
28
|
type FunctionComponent<Props> = ElementType extends never
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// If JSX.ElementType isn’t defined, the valid return type is JSX.Element
|
|
30
|
+
? (props: Props) => JSX.Element | null
|
|
31
31
|
: FunctionElementType extends never
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// If JSX.ElementType is defined, but doesn’t allow function components, function components are disallowed.
|
|
33
|
+
? never
|
|
34
|
+
// If JSX.ElementType allows function components, its return value determines what is a valid.
|
|
35
|
+
: (props: Props) => ReturnType<FunctionElementType>;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* A valid JSX class component.
|
|
39
39
|
*/
|
|
40
40
|
type ClassComponent<Props> = ElementType extends never
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
// If JSX.ElementType isn’t defined, the valid return type is a constructor that returns JSX.ElementClass
|
|
42
|
+
? new(props: Props) => JSX.ElementClass
|
|
43
43
|
: ClassElementType extends never
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// If JSX.ElementType is defined, but doesn’t allow constructors, function components are disallowed.
|
|
45
|
+
? never
|
|
46
|
+
// If JSX.ElementType allows class components, its return value determines what is a valid.
|
|
47
|
+
: new(props: Props) => InstanceType<ClassElementType>;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Any allowed JSX component.
|
|
@@ -62,14 +62,17 @@ interface NestedMDXComponents {
|
|
|
62
62
|
*
|
|
63
63
|
* The key is the name of the element to override. The value is the component to render instead.
|
|
64
64
|
*/
|
|
65
|
-
export type MDXComponents =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
export type MDXComponents =
|
|
66
|
+
& NestedMDXComponents
|
|
67
|
+
& {
|
|
68
|
+
[Key in StringComponent]?: Component<JSX.IntrinsicElements[Key]>;
|
|
69
|
+
}
|
|
70
|
+
& {
|
|
71
|
+
/**
|
|
72
|
+
* If a wrapper component is defined, the MDX content will be wrapped inside of it.
|
|
73
|
+
*/
|
|
74
|
+
wrapper?: Component<any>;
|
|
75
|
+
};
|
|
73
76
|
|
|
74
77
|
/**
|
|
75
78
|
* The props that may be passed to an MDX component.
|