Skip to content

Commit 1c83612

Browse files
committedDec 8, 2022
Fix docs on types
Closes GH-2104.
1 parent 5fbe3f4 commit 1c83612

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed
 

‎docs/docs/getting-started.server.mdx

+7
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,13 @@ Then you can install and use
191191
[`@types/mdx`](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mdx),
192192
which adds types to import statements of supported files.
193193

194+
You can also import several types about the API of MDX files from `@types/mdx`.
195+
For example:
196+
197+
```js path="example.ts"
198+
import type {MDXComponents} from 'mdx/types'
199+
```
200+
194201
### Security
195202

196203
Please note that MDX is a programming language.

‎packages/preact/readme.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,13 @@ components.
158158

159159
This package is fully typed with [TypeScript][].
160160

161-
An additional `Components` type is exported, which represents the acceptable
162-
configuration for the functions and components from this project.
161+
To enable types for imported `.mdx`, `.md`, etcetera files, you should make sure
162+
the TypeScript `JSX` namespace is typed.
163+
This is done by installing and using the types of your framework, as in
164+
[`preact`](https://github.com/preactjs/preact).
165+
Then you can install and use
166+
[`@types/mdx`](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mdx),
167+
which adds types to import statements of supported files.
163168

164169
## Security
165170

‎packages/react/readme.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,13 @@ components.
158158

159159
This package is fully typed with [TypeScript][].
160160

161-
An additional `Components` type is exported, which represents the acceptable
162-
configuration for the functions and components from this project.
161+
To enable types for imported `.mdx`, `.md`, etcetera files, you should make sure
162+
the TypeScript `JSX` namespace is typed.
163+
This is done by installing and using the types of your framework, such as
164+
[`@types/react`](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react).
165+
Then you can install and use
166+
[`@types/mdx`](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mdx),
167+
which adds types to import statements of supported files.
163168

164169
## Security
165170

‎packages/vue/readme.md

-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ Get current components from the MDX Context.
127127

128128
This package is fully typed with [TypeScript][].
129129

130-
An additional `Components` type is exported, which represents the acceptable
131-
configuration for the functions and components from this project.
132-
133130
## Security
134131

135132
See [§ Security][security] on our website for information.

1 commit comments

Comments
 (1)

vercel[bot] commented on Dec 8, 2022

@vercel[bot]

Successfully deployed to the following URLs:

mdx – ./

mdxjs.com
v2.mdxjs.com
mdx-git-main-mdx.vercel.app
mdx-mdx.vercel.app

Please sign in to comment.