diff --git a/README.md b/README.md index 704a8c19..3bcdb362 100644 --- a/README.md +++ b/README.md @@ -399,7 +399,7 @@ const el2 = ; // throws an error 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: ```tsx -const MyArrayComponent = () => Array(5).fill(
) as any as JSX.Element; +const MyArrayComponent = () => (Array(5).fill(
) as any) as JSX.Element; ``` [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 ```tsx type Props = { children: React.ReactNode; type: "submit" | "button" }; export type Ref = HTMLButtonElement; -export const FancyButton = React.forwardRef( - ( - props: Props, - ref: React.Ref // <-- here! - ) => ( - - ) -); +export const FancyButton = React.forwardRef(( + props: Props, + ref: React.Ref // <-- here! +) => ( + +)); ``` diff --git a/docs/advanced/patterns_by_usecase.md b/docs/advanced/patterns_by_usecase.md index 654e4c38..b18964ca 100644 --- a/docs/advanced/patterns_by_usecase.md +++ b/docs/advanced/patterns_by_usecase.md @@ -730,9 +730,9 @@ function isString(a: unknown): a is string { [Read more about User-Defined Type Guards in the Handbook](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards). ### Narrowing using `extends` - + See this quick guide: https://twitter.com/mpocock1/status/1500813765973053440?s=20&t=ImUA-NnZc4iUuPDx-XiMTA - + ## Props: One or the Other but not Both Use the `in` keyword, function overloading, and union types to make components that take either one or another sets of props, but not both: diff --git a/docs/migration/from-flow.md b/docs/migration/from-flow.md index 45e90678..279804a8 100644 --- a/docs/migration/from-flow.md +++ b/docs/migration/from-flow.md @@ -12,4 +12,4 @@ title: From Flow - [Ecobee's brief experience](https://mobile.twitter.com/alanhietala/status/1104450494754377728) - [Migrating a 50K SLOC Flow + React Native app to TypeScript](https://blog.usejournal.com/migrating-a-flow-react-native-app-to-typescript-c74c7bceae7d) - [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) -[entria]: https://medium.com/entria/incremental-migration-to-typescript-on-a-flowtype-codebase-515f6490d92d "Incremental Migration to TypeScript on a Flowtype codebase" + [entria]: https://medium.com/entria/incremental-migration-to-typescript-on-a-flowtype-codebase-515f6490d92d "Incremental Migration to TypeScript on a Flowtype codebase"