Skip to content

Commit f049a47

Browse files
authored
Fix summary tag issues (#485)
1 parent 8034775 commit f049a47

File tree

8 files changed

+15
-44
lines changed

8 files changed

+15
-44
lines changed

docs/basic/getting-started/basic-type-examples.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ export declare interface AppProps {
7474
```
7575

7676
<details>
77-
<summary>
78-
Small `React.ReactNode` edge case
79-
</summary>
77+
<summary><b>Small <code>React.ReactNode</code> edge case</b></summary>
8078

8179
This code typechecks but has a runtime error:
8280

docs/basic/getting-started/default-props.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,7 @@ let el = <Greet age={3} />;
8080
```
8181

8282
<details>
83-
<summary>
84-
85-
`JSX.LibraryManagedAttributes` nuance for library authors
86-
87-
</summary>
83+
<summary><b><code>JSX.LibraryManagedAttributes</code> nuance for library authors</b></summary>
8884

8985
The above implementations work fine for App creators, but sometimes you want to be able to export `GreetProps` so that others can consume it. The problem here is that the way `GreetProps` is defined, `age` is a required prop when it isn't because of `defaultProps`.
9086

@@ -163,7 +159,7 @@ const el = <TestComponent name="foo" />;
163159
## Misc Discussions and Knowledge
164160

165161
<details>
166-
<summary>Why does React.FC break defaultProps?</summary>
162+
<summary><b>Why does <code>React.FC</code> break <code>defaultProps</code>?</b></summary>
167163

168164
You can check the discussions here:
169165

@@ -176,7 +172,7 @@ This is just the current state and may be fixed in future.
176172
</details>
177173

178174
<details>
179-
<summary>TypeScript 2.9 and earlier</summary>
175+
<summary><b>TypeScript 2.9 and earlier</b></summary>
180176

181177
For TypeScript 2.9 and earlier, there's more than one way to do it, but this is the best advice we've yet seen:
182178

docs/basic/getting-started/forms-and-events.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,7 @@ Of course, if you're making any sort of significant form, [you should use Formik
121121
| SyntheticEvent | The base event for all above events. Should be used when unsure about event type |
122122

123123
<details>
124-
<summary>
125-
126-
**What about `InputEvent`?**
127-
128-
</summary>
124+
<summary><b>What about <code>InputEvent</code>?</b></summary>
129125

130126
You've probably noticed that there is no `InputEvent`. This is because it is not supported by Typescript as the event itself has no fully browser support and may behave differently in different browsers. You can use `KeyboardEvent` instead.
131127

docs/basic/getting-started/forward-create-ref.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ export const FancyButton = React.forwardRef<Ref, Props>((props, ref) => (
2929
```
3030

3131
<details>
32-
<summary>
33-
34-
Side note: the `ref` you get from `forwardRef` is mutable so you can assign to it if needed.
35-
36-
</summary>
32+
<summary><b>Side note: the <code>ref</code> you get from <code>forwardRef</code> is mutable so you can assign to it if needed.</b></summary>
3733

3834
This was done [on purpose](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/43265/). You can make it immutable if you have to - assign `React.Ref` if you want to ensure nobody reassigns it:
3935

docs/basic/getting-started/function-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const App = ({ message }: { message: string }) => <div>{message}</div>;
2525
2626
<details>
2727

28-
<summary><b>Why is `React.FC` discouraged? What about `React.FunctionComponent`/`React.VoidFunctionComponent`?</b></summary>
28+
<summary><b>Why is <code>React.FC</code> discouraged? What about <code>React.FunctionComponent</code>/<code>React.VoidFunctionComponent</code>?</b></summary>
2929

3030
You may see this in many React+TypeScript codebases:
3131

@@ -55,7 +55,7 @@ const Title: React.FunctionComponent<{ title: string }> = ({
5555
```
5656

5757
<details>
58-
<summary>Using `React.VoidFunctionComponent` or `React.VFC` instead</summary>
58+
<summary><b>Using <code>React.VoidFunctionComponent</code> or <code>React.VFC</code> instead</b></summary>
5959

6060
As of [@types/react 16.9.48](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46643), you can also use `React.VoidFunctionComponent` or `React.VFC` type if you want to type `children` explicitly. This is an interim solution until `FunctionComponent` will accept no children by default (planned for `@types/react@^18.0.0`).
6161

docs/basic/getting-started/hooks.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function Counter() {
7979

8080
<details>
8181

82-
<summary><b>Usage with `Reducer` from `redux`</b></summary>
82+
<summary><b>Usage with <code>Reducer</code> from <code>redux</code></b></summary>
8383

8484
In case you use the [redux](https://github.com/reduxjs/redux) library to write reducer function, It provides a convenient helper of the format `Reducer<State, Action>` which takes care of the return type for you.
8585

@@ -115,9 +115,7 @@ function DelayedEffect(props: { timerMs: number }) {
115115
```
116116

117117
<details>
118-
<summary>
119-
Solution to the above example
120-
</summary>
118+
<summary><b>Solution to the above example</b></summary>
121119

122120
```tsx
123121
function DelayedEffect(props: { timerMs: number }) {
@@ -175,12 +173,7 @@ doSomethingWith(divRef.current);
175173
Note that you are opting out of type safety here - you will have a runtime error if you forget to assign the ref to an element in the render, or if the ref-ed element is conditionally rendered.
176174

177175
<details>
178-
<summary>
179-
180-
Tip: Choosing which `HTMLElement` to use
181-
182-
</summary>
183-
176+
<summary><b>Tip: Choosing which <code>HTMLElement</code> to use</b></summary>
184177

185178
Refs demand specificity - it is not enough to just specify any old `HTMLElement`. If you don't know the name of the element type you need, you can check [lib.dom.ts](https://github.com/microsoft/TypeScript/blob/v3.9.5/lib/lib.dom.d.ts#L19224-L19343) or make an intentional type error and let the language service tell you:
186179

docs/basic/setup.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ Local dev setups:
3737
- [TSDX](https://tsdx.io/): `npx tsdx create mylib` for Creating React+TS _libraries_. (in future: [TurboRepo](https://twitter.com/jaredpalmer/status/1346217789942591488))
3838

3939
<details>
40-
<summary>
41-
Other tools
42-
</summary>
40+
<summary><b>Other tools</b></summary>
4341

4442
Less mature tools still worth checking out:
4543

@@ -73,7 +71,7 @@ import ReactDOM from "react-dom";
7371

7472
<details>
7573

76-
<summary>Explanation</summary>
74+
<summary><b>Explanation</b></summary>
7775

7876
Why `allowSyntheticDefaultImports` over `esModuleInterop`? [Daniel Rosenwasser](https://twitter.com/drosenwasser/status/1003097042653073408) has said that it's better for webpack/parcel. For more discussion check out <https://github.com/wmonk/create-react-app-typescript/issues/214>
7977

docs/basic/troubleshooting/types.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,7 @@ partialStateUpdate({ foo: 2 }); // this works
295295
```
296296

297297
<details>
298-
<summary>
299-
Minor caveats on using <code>Partial</code>
300-
</summary>
298+
<summary><b>Minor caveats on using <code>Partial</code></b></summary>
301299

302300
Note that there are some TS users who don't agree with using `Partial` as it behaves today. See [subtle pitfalls of the above example here](https://twitter.com/ferdaber/status/1084798596027957248), and check out this long discussion on [why @types/react uses Pick instead of Partial](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/18365).
303301

@@ -452,11 +450,7 @@ declare module 'use-untyped-hook' {
452450
```
453451

454452
<details>
455-
<summary>
456-
457-
For instance, the [useDarkMode hook](https://github.com/donavon/use-dark-mode) exports the functions that follows a similar structure.
458-
459-
</summary>
453+
<summary><b>For instance, the <a href="https://github.com/donavon/use-dark-mode">useDarkMode hook</a> exports the functions that follows a similar structure.</b></summary>
460454

461455
```js
462456
// inside src/index.js

0 commit comments

Comments
 (0)