@types/mdx 2.0.7 → 2.0.8
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 -1
- mdx/index.d.ts +16 -16
- mdx/package.json +3 -3
- mdx/types.d.ts +24 -21
mdx/LICENSE
CHANGED
|
File without changes
|
mdx/README.md
CHANGED
|
@@ -8,7 +8,7 @@ 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, 27 Sep 2023 09:42:15 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: none
|
|
14
14
|
|
mdx/index.d.ts
CHANGED
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
*
|
|
59
59
|
* It should now be possible to import both the MDX component and the exported constant `message`.
|
|
60
60
|
*/
|
|
61
|
-
declare module
|
|
61
|
+
declare module "*.mdx" {
|
|
62
62
|
// eslint-disable-next-line @definitelytyped/no-self-import
|
|
63
|
-
import { MDXProps } from
|
|
63
|
+
import { MDXProps } from "mdx/types";
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* An function component which renders the MDX content using JSX.
|
|
@@ -78,48 +78,48 @@ declare module '*.mdx' {
|
|
|
78
78
|
/**
|
|
79
79
|
* A markdown file which exports a JSX component.
|
|
80
80
|
*/
|
|
81
|
-
declare module
|
|
82
|
-
export { default } from
|
|
81
|
+
declare module "*.md" {
|
|
82
|
+
export { default } from "*.mdx";
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* A markdown file which exports a JSX component.
|
|
87
87
|
*/
|
|
88
|
-
declare module
|
|
89
|
-
export { default } from
|
|
88
|
+
declare module "*.markdown" {
|
|
89
|
+
export { default } from "*.mdx";
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* A markdown file which exports a JSX component.
|
|
94
94
|
*/
|
|
95
|
-
declare module
|
|
96
|
-
export { default } from
|
|
95
|
+
declare module "*.mdown" {
|
|
96
|
+
export { default } from "*.mdx";
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* A markdown file which exports a JSX component.
|
|
101
101
|
*/
|
|
102
|
-
declare module
|
|
103
|
-
export { default } from
|
|
102
|
+
declare module "*.mkdn" {
|
|
103
|
+
export { default } from "*.mdx";
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* A markdown file which exports a JSX component.
|
|
108
108
|
*/
|
|
109
|
-
declare module
|
|
110
|
-
export { default } from
|
|
109
|
+
declare module "*.mkd" {
|
|
110
|
+
export { default } from "*.mdx";
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* A markdown file which exports a JSX component.
|
|
115
115
|
*/
|
|
116
|
-
declare module
|
|
117
|
-
export { default } from
|
|
116
|
+
declare module "*.mkdown" {
|
|
117
|
+
export { default } from "*.mdx";
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* A markdown file which exports a JSX component.
|
|
122
122
|
*/
|
|
123
|
-
declare module
|
|
124
|
-
export { default } from
|
|
123
|
+
declare module "*.ron" {
|
|
124
|
+
export { default } from "*.mdx";
|
|
125
125
|
}
|
mdx/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/mdx",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "TypeScript definitions for mdx",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mdx",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts": {},
|
|
32
32
|
"dependencies": {},
|
|
33
|
-
"typesPublisherContentHash": "
|
|
34
|
-
"typeScriptVersion": "4.
|
|
33
|
+
"typesPublisherContentHash": "b7d09eab9948419eec6e26d190d6cd3ffd8f3e56eeb7e00aff673775be0dfbb8",
|
|
34
|
+
"typeScriptVersion": "4.5"
|
|
35
35
|
}
|
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.
|