Skip to content

Commit f03211f

Browse files
authored
chore: format (#491)
1 parent 82e4032 commit f03211f

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ const el2 = <MyArrayComponent />; // throws an error
399399
Unfortunately just annotating the function type will not help so if you really need to return other exotic types that React supports, you'd need to perform a type assertion:
400400

401401
```tsx
402-
const MyArrayComponent = () => Array(5).fill(<div />) as any as JSX.Element;
402+
const MyArrayComponent = () => (Array(5).fill(<div />) as any) as JSX.Element;
403403
```
404404

405405
[See commentary by @ferdaber here](https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/issues/57).
@@ -1787,16 +1787,14 @@ This was done [on purpose](https://github.com/DefinitelyTyped/DefinitelyTyped/pu
17871787
```tsx
17881788
type Props = { children: React.ReactNode; type: "submit" | "button" };
17891789
export type Ref = HTMLButtonElement;
1790-
export const FancyButton = React.forwardRef(
1791-
(
1792-
props: Props,
1793-
ref: React.Ref<Ref> // <-- here!
1794-
) => (
1795-
<button ref={ref} className="MyClassName" type={props.type}>
1796-
{props.children}
1797-
</button>
1798-
)
1799-
);
1790+
export const FancyButton = React.forwardRef((
1791+
props: Props,
1792+
ref: React.Ref<Ref> // <-- here!
1793+
) => (
1794+
<button ref={ref} className="MyClassName" type={props.type}>
1795+
{props.children}
1796+
</button>
1797+
));
18001798
```
18011799

18021800
</details>

docs/advanced/patterns_by_usecase.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,9 @@ function isString(a: unknown): a is string {
730730
[Read more about User-Defined Type Guards in the Handbook](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards).
731731

732732
### Narrowing using `extends`
733-
733+
734734
See this quick guide: https://twitter.com/mpocock1/status/1500813765973053440?s=20&t=ImUA-NnZc4iUuPDx-XiMTA
735-
735+
736736
## Props: One or the Other but not Both
737737

738738
Use the `in` keyword, function overloading, and union types to make components that take either one or another sets of props, but not both:

docs/migration/from-flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ title: From Flow
1212
- [Ecobee's brief experience](https://mobile.twitter.com/alanhietala/status/1104450494754377728)
1313
- [Migrating a 50K SLOC Flow + React Native app to TypeScript](https://blog.usejournal.com/migrating-a-flow-react-native-app-to-typescript-c74c7bceae7d)
1414
- [How we migrated 400K+ lines of code from Flow to TypeScript at Factorial](https://labs.factorialhr.com/posts/how-we-migrated-400k-lines-of-code-from-flow-to-typescript)
15-
[entria]: https://medium.com/entria/incremental-migration-to-typescript-on-a-flowtype-codebase-515f6490d92d "Incremental Migration to TypeScript on a Flowtype codebase"
15+
[entria]: https://medium.com/entria/incremental-migration-to-typescript-on-a-flowtype-codebase-515f6490d92d "Incremental Migration to TypeScript on a Flowtype codebase"

0 commit comments

Comments
 (0)