Skip to content

Commit 59f4eb6

Browse files
authored
Switch to <Note>s instead
Signed-off-by: Karl Horky <karl.horky@gmail.com>
1 parent 8303315 commit 59f4eb6

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

docs/docs/using-mdx.mdx

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -206,28 +206,12 @@ console.log(React.createElement(Example, {name: 'Venus', year: 2021}))
206206
console.log(<Example name="Mars" year={2022} />)
207207
```
208208
209-
#### TypeScript: `Props` Type
210-
211-
To declare a type for the `props` object, use the JSDoc `@typedef` tag:
212-
213-
```mdx
214-
{/**
215-
* @typedef Props
216-
* @property {string} name
217-
* Who to greet. */}
218-
219-
# Hello {props.name}
220-
```
221-
222-
This will be used by [the MDX VS Code extension][mdx-vscode-extension] to show
223-
JSDoc information and errors in IntelliSense hovers (see the
224-
[MDX Analyzer Props docs][mdx-analyzer-props-docs] for more details):
225-
226-
![Screenshot of MDX VS Code extension with `example.mdx` file open, showing mouse hovering over “name” in “props.name”, with the IntelliSense hover card showing the details from the JSDoc type](https://github.com/mdx-js/mdx/assets/1935696/de2cdc80-099f-412a-80c1-422d320fb3d0)
227-
228-
![Screenshot of MDX VS Code extension with `example.mdx` file open, showing mouse hovering over the red-underlined “nam” in “props.nam”, with the IntelliSense hover card showing the error “Property ‘nam’ does not exist ...”](https://github.com/mdx-js/mdx/assets/1935696/ceb5612d-fb36-47b0-8ef5-415e1fa32684)
229-
230-
![Screenshot of MDX VS Code extension with `example.tsx` file open, showing mouse hovering over the red-underlined “Example” in “<Example />”, with the IntelliSense hover card showing the error “Property ‘name’ is missing ...”](https://github.com/mdx-js/mdx/assets/1935696/d510f1c8-6fe4-4527-8f6f-bd46bd737077)
209+
<Note type="info">
210+
**Note**:
211+
Users of [the MDX VS Code extension][mdx-vscode-extension] can add type
212+
checking of `props` with a JSDoc comment.
213+
See [`mdx-js/mdx-analyzer`][mdx-analyzer] for more info.
214+
</Note>
231215
232216
### Components
233217
@@ -348,6 +332,13 @@ as follows:
348332
* Otherwise, if it starts with a lowercase, it’s a literal (`<a>` -> `h('a')`)
349333
* Otherwise, it’s an identifier (`<A>` -> `h(A)`), which means a component `A`
350334
335+
<Note type="info">
336+
**Note**:
337+
Users of [the MDX VS Code extension][mdx-vscode-extension] can add type
338+
checking of provided and passed components with a JSDoc comment.
339+
See [`mdx-js/mdx-analyzer`][mdx-analyzer] for more info.
340+
</Note>
341+
351342
### Layout
352343
353344
There is one special component: the layout.
@@ -557,7 +548,7 @@ providers: pass components explicitly.
557548
558549
[what]: /docs/what-is-mdx/
559550
560-
[mdx-analyzer-props-docs]: https://github.com/mdx-js/mdx-analyzer#props
551+
[mdx-analyzer]: https://github.com/mdx-js/mdx-analyzer
561552
562553
[mdx-react]: /packages/react/
563554

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy