@types/mdx 2.0.1 → 2.0.3

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.
Files changed (4) hide show
  1. mdx/README.md +1 -1
  2. mdx/index.d.ts +8 -2
  3. mdx/package.json +3 -3
  4. mdx/types.d.ts +10 -11
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: Sun, 17 Oct 2021 19:31:17 GMT
11
+ * Last updated: Tue, 18 Oct 2022 17:02:55 GMT
12
12
  * Dependencies: none
13
13
  * Global values: none
14
14
 
mdx/index.d.ts CHANGED
@@ -33,8 +33,8 @@
33
33
  * ```
34
34
  *
35
35
  * The previous example added types to *all* `.mdx` files.
36
- * To define additional types for a specific MDX file, create a file with the same name but postfixed
37
- * with `.d.ts` next to the MDX file.
36
+ * To define types for a specific MDX file, create a file with the same name but postfixed with
37
+ * `.d.ts` next to the MDX file.
38
38
  *
39
39
  * For example, given the following MDX file `my-component.mdx`:
40
40
  *
@@ -47,9 +47,15 @@
47
47
  * Create the following file named `my-component.mdx.d.ts` in the same directory:
48
48
  *
49
49
  * ```ts
50
+ * export { default } from '*.mdx';
51
+ *
50
52
  * export const message: string;
51
53
  * ```
52
54
  *
55
+ * Note that this overwrites the `declare module '*.mdx' { … }` types from earlier, which is why you
56
+ * also need to define the default export. You can also define your own default export type to narrow
57
+ * the accepted prop types of this specific file.
58
+ *
53
59
  * It should now be possible to import both the MDX component and the exported constant `message`.
54
60
  */
55
61
  declare module '*.mdx' {
mdx/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/mdx",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
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": "b7ee723a8e8a51357fdba1928d23f2f6d00238c340cc18b185941482b711ee00",
34
- "typeScriptVersion": "3.9"
33
+ "typesPublisherContentHash": "34b229059b2ba6024fdf79852a3dfac83188851aa3f53ce094d14073d82015cc",
34
+ "typeScriptVersion": "4.1"
35
35
  }
mdx/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Internal helper types
2
2
 
3
3
  // tslint:disable-next-line: strict-export-declare-modifiers
4
- type FunctionComponent<Props> = (props: Props) => JSX.Element;
4
+ type FunctionComponent<Props> = (props: Props) => JSX.Element | null;
5
5
  // tslint:disable-next-line: strict-export-declare-modifiers
6
6
  type ClassComponent<Props> = new (props: Props) => JSX.ElementClass;
7
7
  // tslint:disable-next-line: strict-export-declare-modifiers
@@ -18,15 +18,14 @@ interface NestedMDXComponents {
18
18
  *
19
19
  * The key is the name of the element to override. The value is the component to render instead.
20
20
  */
21
- export type MDXComponents = NestedMDXComponents &
22
- {
23
- [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]> | keyof JSX.IntrinsicElements;
24
- } & {
25
- /**
26
- * If a wrapper component is defined, the MDX content will be wrapped inside of it.
27
- */
28
- wrapper?: Component<any>;
29
- };
21
+ export type MDXComponents = NestedMDXComponents & {
22
+ [Key in keyof JSX.IntrinsicElements]?: Component<JSX.IntrinsicElements[Key]> | keyof JSX.IntrinsicElements;
23
+ } & {
24
+ /**
25
+ * If a wrapper component is defined, the MDX content will be wrapped inside of it.
26
+ */
27
+ wrapper?: Component<any>;
28
+ };
30
29
 
31
30
  /**
32
31
  * The props that may be passed to an MDX component.
@@ -47,7 +46,7 @@ export interface MDXProps {
47
46
  /**
48
47
  * The type of the default export of an MDX module.
49
48
  */
50
- export type MDXContent = FunctionComponent<MDXProps>;
49
+ export type MDXContent = (props: MDXProps) => JSX.Element;
51
50
 
52
51
  /**
53
52
  * A generic MDX module type.