Skip to content

Commit 94ca674

Browse files
authored
add link to TS FAQ
1 parent 1a0a5a5 commit 94ca674

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,8 @@ _Not written yet._ watch <https://github.com/sw-yx/fresh-async-react> for more o
988988

989989
# Basic Troubleshooting Handbook: Types
990990

991+
> ⚠️ Have you read [the TypeScript FAQ](https://github.com/microsoft/TypeScript/wiki/FAQ)?) Your answer might be there!
992+
991993
Facing weird type errors? You aren't alone. This is the hardest part of using TypeScript with React. Be patient - you are learning a new language after all. However, the more you get good at this, the less time you'll be working _against_ the compiler and the more the compiler will be working _for_ you!
992994

993995
Try to avoid typing with `any` as much as possible to experience the full benefits of typescript. Instead, let's try to be familiar with some of the common strategies to solve these issues.
@@ -1091,14 +1093,8 @@ A simpler alternative to enum is just declaring a bunch of strings with union:
10911093
export declare type Position = "left" | "right" | "top" | "bottom";
10921094
```
10931095

1094-
<details>
1095-
1096-
<summary>Brief Explanation</summary>
1097-
10981096
This is handy because TypeScript will throw errors when you mistype a string for your props.
10991097

1100-
</details>
1101-
11021098
## Type Assertion
11031099

11041100
Sometimes you know better than TypeScript that the type you're using is narrower than it thinks, or union types need to be asserted to a more specific type to work with other APIs, so assert with the `as` keyword. This tells the compiler you know better than it does.

0 commit comments

Comments
 (0)