You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ This guide will always assume you are starting with the latest TypeScript versio
82
82
83
83
## React + TypeScript Starter Kits
84
84
85
-
1.[Create React App v2.1+ with Typescript](https://facebook.github.io/create-react-app/docs/adding-typescript): `npm createreact-app my-new-react-typescript-app --typescript`
85
+
1.[Create React App v2.1+ with Typescript](https://facebook.github.io/create-react-app/docs/adding-typescript): `npx create-react-app my-new-react-typescript-app --typescript`
86
86
87
87
- We used to recommend `create-react-app-typescript` but it is now [deprecated](https://www.reddit.com/r/reactjs/comments/a5919a/createreactapptypescript_has_been_archived_rip/). [see migration instructions](https://vincenttunru.com/migrate-create-react-app-typescript-to-create-react-app/)
88
88
@@ -427,15 +427,15 @@ let el = <Greet />;
427
427
```
428
428
<details>
429
429
<summary>Why does React.FC break defaultProps?</summary>
This is just the current state and may be fixed in future.
438
-
438
+
439
439
</details>
440
440
441
441
<details>
@@ -750,7 +750,7 @@ _Not written yet._ watch <https://github.com/sw-yx/fresh-async-react> for more o
750
750
751
751
# Basic Troubleshooting Handbook: Types
752
752
753
-
Facing weird type errors? You aren't alone. This is the hardest part of using TypeScript with React. Be patience - 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!
753
+
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!
754
754
755
755
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.
756
756
@@ -804,7 +804,7 @@ function isAdmin(usr: Admin | User): usr is Admin {
804
804
}
805
805
```
806
806
807
-
If you need `if/elseif` chains or the `switch` statement instead, it should "just work", but look up [Discriminated Unions](https://www.typescriptlang.org/docs/handbook/advanced-types.html) if you need help. (See also: [Basarat's writeup](https://basarat.gitbooks.io/typescript/docs/types/discriminated-unions.html)). This is handy in typing reducers for `useReducer` or Redux.
807
+
If you need `if...else` chains or the `switch` statement instead, it should "just work", but look up [Discriminated Unions](https://www.typescriptlang.org/docs/handbook/advanced-types.html) if you need help. (See also: [Basarat's writeup](https://basarat.gitbooks.io/typescript/docs/types/discriminated-unions.html)). This is handy in typing reducers for `useReducer` or Redux.
808
808
809
809
## Optional Types
810
810
@@ -978,7 +978,7 @@ type FooReturn = ReturnType<typeof foo>; // { baz: number }
978
978
Use [declaration merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html):
979
979
980
980
```ts
981
-
// declaration.d.ts
981
+
// declaration.d.ts
982
982
// anywhere in your project, NOT the same name as any of your .ts/tsx files
983
983
declare module '*.png'
984
984
@@ -990,7 +990,7 @@ Related issue: https://github.com/Microsoft/TypeScript-React-Starter/issues/12 a
990
990
991
991
# Troubleshooting Handbook: TSLint
992
992
993
-
Sometimes TSLint is just getting in the way. Judicious turning off of things can be helpful. Here are useful tslint disables you may use:
993
+
Sometimes TSLint is just getting in the way. Judiciously turning off of things can be helpful. Here are useful tslint disables you may use:
0 commit comments