Skip to content

Commit 170096e

Browse files
Remove migration cheat sheet (#818)
1 parent 38ec3b0 commit 170096e

16 files changed

Lines changed: 6 additions & 360 deletions

File tree

.github/ISSUE_TEMPLATE/migrating-cheatsheet.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ Cheatsheet for using React with TypeScript.
3434
- It also has miscellaneous tips and tricks for pro users.
3535
- Advice for contributing to DefinitelyTyped.
3636
- The goal is to take _full advantage_ of TypeScript.
37-
- [The Migrating Cheatsheet](https://react-typescript-cheatsheet.netlify.app/docs/migration) helps collate advice for incrementally migrating large codebases from JS or Flow, **from people who have done it**.
38-
- We do not try to convince people to switch, only to help people who have already decided.
39-
- ⚠️This is a new cheatsheet, all assistance is welcome.
4037
- [The HOC Cheatsheet](https://react-typescript-cheatsheet.netlify.app/docs/hoc) specifically teaches people to write HOCs with examples.
4138
- Familiarity with [Generics](https://www.typescriptlang.org/docs/handbook/2/generics.html) is necessary.
4239
- ⚠️This is the newest cheatsheet, all assistance is welcome.
@@ -2433,8 +2430,6 @@ npm install -g dts-gen
24332430
dts-gen -m <your-module>
24342431
```
24352432

2436-
There are other automated JS to TS conversion tools and migration strategies - see [our MIGRATION cheatsheet](https://react-typescript-cheatsheet.netlify.app/docs/migration/from_js).
2437-
24382433
##### Typing Exported Hooks
24392434

24402435
Typing Hooks is just like typing pure functions.
@@ -2540,8 +2535,6 @@ declare module "use-dark-mode" {
25402535

25412536
In case of typing untyped class components, there's almost no difference in approach except for the fact that after declaring the types, you export the extend the type using `class UntypedClassComponent extends React.Component<UntypedClassComponentProps, any> {}` where `UntypedClassComponentProps` holds the type declaration.
25422537

2543-
For instance, [sw-yx's Gist on React Router 6 types](https://gist.github.com/sw-yx/37a6a3d248c2d4031801f0d568904df8) implemented a similar method for typing the then untyped RR6.
2544-
25452538
```ts
25462539
declare module "react-router-dom" {
25472540
import * as React from 'react';
@@ -2556,8 +2549,6 @@ declare module "react-router-dom" {
25562549
// ...
25572550
```
25582551
2559-
For more information on creating type definitions for class components, you can refer to this [post](https://templecoding.com/blog/2016/03/31/creating-typescript-typings-for-existing-react-components) for reference.
2560-
25612552
#### Frequent Known Problems with TypeScript
25622553
25632554
Just a list of stuff that React developers frequently run into, that TS has no solution for. Not necessarily TSX only.
@@ -2943,7 +2934,7 @@ If you're looking for information on Prettier, check out the [Prettier](https://
29432934
9. bangbang checks `if (!!nonboolean)`
29442935
10. `!= null` to check for `null` and `undefined`
29452936
- [Ultimate React Component Patterns with TypeScript 2.8](https://levelup.gitconnected.com/ultimate-react-component-patterns-with-typescript-2-8-82990c516935)
2946-
- [Basarat's TypeScript gitbook has a React section](https://basarat.gitbook.io/typescript/tsx/react) with an [Egghead.io course](https://egghead.io/courses/use-typescript-to-develop-react-applications) as well.
2937+
- [Basarat's TypeScript gitbook has a React section](https://basarat.gitbook.io/typescript/tsx/react).
29472938
- [Palmer Group's TypeScript + React Guidelines](https://github.com/palmerhq/typescript) as well as Jared's other work like [disco.chat](https://github.com/jaredpalmer/disco.chat)
29482939
- [Sindre Sorhus' TypeScript Style Guide](https://github.com/sindresorhus/typescript-definition-style-guide)
29492940
- [TypeScript React Starter Template by Microsoft](https://github.com/Microsoft/TypeScript-React-Starter) A starter template for TypeScript and React with a detailed README describing how to use the two together. Note: this doesn't seem to be frequently updated anymore.
@@ -2993,7 +2984,6 @@ It is worth mentioning some resources to help you get started:
29932984
- Anders Hejlsberg's overview of TS: https://www.youtube.com/watch?v=ET4kT88JRXs
29942985
- Marius Schultz: https://blog.mariusschulz.com/series/typescript-evolution with an [Egghead.io course](https://egghead.io/courses/advanced-static-types-in-typescript)
29952986
- Basarat's Deep Dive: https://basarat.gitbook.io/typescript/
2996-
- Axel Rauschmeyer's [Tackling TypeScript](https://exploringjs.com/tackling-ts/)
29972987
- Rares Matei: [Egghead.io course](https://egghead.io/courses/practical-advanced-typescript)'s advanced TypeScript course on Egghead.io is great for newer typescript features and practical type logic applications (e.g. recursively making all properties of a type `readonly`)
29982988
- Learn about [Generics, Conditional types and Mapped types](https://www.youtube.com/watch?v=PJjeHzvi_VQ&feature=youtu.be)
29992989
- Shu Uesugi: [TypeScript for Beginner Programmers](https://ts.chibicode.com/)

docs/advanced/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ title: Advanced Cheatsheet
1212

1313
**Creating React + TypeScript Libraries**
1414

15-
The best tool for creating React + TS libraries right now is [`tsdx`](https://github.com/palmerhq/tsdx). Run `npx tsdx create` and select the "react" option. You can view [the React User Guide](https://github.com/palmerhq/tsdx/issues/5) for a few tips on React+TS library best practices and optimizations for production.
15+
The best tool for creating React + TS libraries right now is [`tsdx`](https://github.com/palmerhq/tsdx). Run `npx tsdx create` and select the "react" option.
1616

1717
Another option is [Rollpkg](https://github.com/rafgraph/rollpkg), which uses Rollup and the TypeScript compiler (not Babel) to create packages. It includes default configs for TypeScript, Prettier, ESLint, and Jest (setup for use with React), as well as Bundlephobia package stats for each build.
1818

19-
- Be sure to also check [`basarat`'s guide](https://basarat.gitbooks.io/typescript/content/docs/quick/library.html) for library tsconfig settings.
2019
- Alec Larson: [The best Rollup config for TypeScript libraries](https://gist.github.com/aleclarson/9900ed2a9a3119d865286b218e14d226)
2120
- From the Angular world, check out https://github.com/bitjson/typescript-starter

docs/advanced/misc-concerns.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class MyComponent extends React.Component<MyComponentProps, {}> {
2828

2929
## Commenting Components
3030

31-
TypeScript uses [TSDoc](https://github.com/Microsoft/tsdoc), a variant of JSDoc for TypeScript. This is very handy for writing component libraries and having useful descriptions pop up in autocomplete and other tooling (like the [Docz PropsTable](https://www.docz.site/docs/components-api#propstable)). The main thing to remember is to use `/** YOUR_COMMENT_HERE */` syntax in the line just above whatever you're annotating.
31+
TypeScript uses [TSDoc](https://github.com/Microsoft/tsdoc), a variant of JSDoc for TypeScript. This is very handy for writing component libraries and having useful descriptions pop up in autocomplete and other tooling. The main thing to remember is to use `/** YOUR_COMMENT_HERE */` syntax in the line just above whatever you're annotating.
3232

3333
```tsx
3434
interface MyComponentProps {
@@ -87,26 +87,6 @@ For developing with Storybook, read the docs I wrote over here: [https://storybo
8787

8888
[Something to add? File an issue](https://github.com/typescript-cheatsheets/react/issues/new).
8989

90-
## Migrating From Flow
91-
92-
You should check out large projects that are migrating from flow to pick up concerns and tips:
93-
94-
- [Jest](https://github.com/facebook/jest/pull/7554)
95-
- [Expo](https://github.com/expo/expo/issues/2164)
96-
- [React-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd/issues/982)
97-
- [Storybook](https://github.com/storybooks/storybook/issues/5030)
98-
- [VueJS](https://medium.com/the-vue-point/plans-for-the-next-iteration-of-vue-js-777ffea6fabf)
99-
100-
Useful libraries:
101-
102-
- [https://github.com/bcherny/flow-to-typescript](https://github.com/bcherny/flow-to-typescript)
103-
- [https://github.com/Khan/flow-to-ts](https://github.com/Khan/flow-to-ts)
104-
- [https://github.com/piotrwitek/utility-types](https://github.com/piotrwitek/utility-types)
105-
106-
If you have specific advice in this area, please file a PR!
107-
108-
[Something to add? File an issue](https://github.com/typescript-cheatsheets/react/issues/new).
109-
11090
## Prettier
11191

11292
There isn't any real secret to Prettier for TypeScript. But its a great idea to run prettier on every commit!
@@ -144,7 +124,7 @@ $ yarn add -D prettier husky lint-staged
144124

145125
Integrating this with ESlint may be a problem. We haven't written much on this yet, please contribute if you have a strong opinion. [Here's a helpful gist.](https://gist.github.com/JirkaVebr/519c7597517e4ba756d5b89e7cb4cc0e)
146126

147-
For library authors, this is set up for you in [tsdx](https://github.com/palmerhq/tsdx/pull/45/files). You may also wish to check out the newer https://ts-engine.dev/ project.
127+
For library authors, this is set up for you in [tsdx](https://github.com/palmerhq/tsdx/pull/45/files).
148128

149129
## Testing
150130

docs/advanced/patterns_by_version.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ _TypeScript version guides before 2.9 are unwritten, please feel free to send a
1010

1111
## TypeScript 2.9
1212

13-
[[Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html) | [Blog Post](https://blogs.msdn.microsoft.com/typescript/2018/05/31/announcing-typescript-2-9/)]
13+
[[Release Notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-9.html)]
1414

1515
1. Type arguments for tagged template strings (e.g. `styled-components`):
1616

@@ -568,5 +568,3 @@ nothing react specific
568568
## TypeScript Roadmap and Spec
569569

570570
https://github.com/Microsoft/TypeScript/wiki/Roadmap
571-
572-
Did you also know you can read the TypeScript spec online?? https://github.com/microsoft/TypeScript/blob/master/doc/spec-ARCHIVED.md

docs/advanced/utility-types.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ We will assume knowledge of utility types covered in the sister project [`typesc
88

99
If you intend to maintain a large TS codebase/a nontrivial React+TS library, **we strongly recommend exploring these utilities** so that you don't reinvent the wheel and/or lose sanity trying to do so. Studying their code can also teach you a lot of advanced TS that is not covered here.
1010

11-
I also recommend having a good working knowledge of how to construct the inbuilt utility types from scratch. See [Dr. Rauschmayer's guide](https://2ality.com/2020/06/computing-with-types.html) for a concise introduction.
12-
1311
A level of comfort with **generic types** is therefore required. Here are some helpful resources:
1412

1513
- https://ts.chibicode.com/generics/

docs/basic/recommended/codebases.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ sidebar_label: Codebases
2727
Older but still worth checking:
2828

2929
- https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
30-
- https://github.com/contiamo/operational-ui
3130

3231
React Boilerplates:
3332

docs/basic/recommended/resources.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sidebar_label: Other resources
1919
9. bangbang checks `if (!!nonboolean)`
2020
10. `!= null` to check for `null` and `undefined`
2121
- [Ultimate React Component Patterns with TypeScript 2.8](https://levelup.gitconnected.com/ultimate-react-component-patterns-with-typescript-2-8-82990c516935)
22-
- [Basarat's TypeScript gitbook has a React section](https://basarat.gitbook.io/typescript/tsx/react) with an [Egghead.io course](https://egghead.io/courses/use-typescript-to-develop-react-applications) as well.
22+
- [Basarat's TypeScript gitbook has a React section](https://basarat.gitbook.io/typescript/tsx/react).
2323
- [Palmer Group's TypeScript + React Guidelines](https://github.com/palmerhq/typescript) as well as Jared's other work like [disco.chat](https://github.com/jaredpalmer/disco.chat)
2424
- [Sindre Sorhus' TypeScript Style Guide](https://github.com/sindresorhus/typescript-definition-style-guide)
2525
- [TypeScript React Starter Template by Microsoft](https://github.com/Microsoft/TypeScript-React-Starter) A starter template for TypeScript and React with a detailed README describing how to use the two together. Note: this doesn't seem to be frequently updated anymore.

docs/basic/troubleshooting/learn-ts.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ It is worth mentioning some resources to help you get started:
1414
- Anders Hejlsberg's overview of TS: https://www.youtube.com/watch?v=ET4kT88JRXs
1515
- Marius Schultz: https://blog.mariusschulz.com/series/typescript-evolution with an [Egghead.io course](https://egghead.io/courses/advanced-static-types-in-typescript)
1616
- Basarat's Deep Dive: https://basarat.gitbook.io/typescript/
17-
- Axel Rauschmeyer's [Tackling TypeScript](https://exploringjs.com/tackling-ts/)
1817
- Rares Matei: [Egghead.io course](https://egghead.io/courses/practical-advanced-typescript)'s advanced TypeScript course on Egghead.io is great for newer typescript features and practical type logic applications (e.g. recursively making all properties of a type `readonly`)
1918
- Learn about [Generics, Conditional types and Mapped types](https://www.youtube.com/watch?v=PJjeHzvi_VQ&feature=youtu.be)
2019
- Shu Uesugi: [TypeScript for Beginner Programmers](https://ts.chibicode.com/)

docs/basic/troubleshooting/types.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,6 @@ npm install -g dts-gen
413413
dts-gen -m <your-module>
414414
```
415415

416-
There are other automated JS to TS conversion tools and migration strategies - see [our MIGRATION cheatsheet](https://react-typescript-cheatsheet.netlify.app/docs/migration/from_js).
417-
418416
### Typing Exported Hooks
419417

420418
Typing Hooks is just like typing pure functions.
@@ -520,8 +518,6 @@ declare module "use-dark-mode" {
520518

521519
In case of typing untyped class components, there's almost no difference in approach except for the fact that after declaring the types, you export the extend the type using `class UntypedClassComponent extends React.Component<UntypedClassComponentProps, any> {}` where `UntypedClassComponentProps` holds the type declaration.
522520

523-
For instance, [sw-yx's Gist on React Router 6 types](https://gist.github.com/sw-yx/37a6a3d248c2d4031801f0d568904df8) implemented a similar method for typing the then untyped RR6.
524-
525521
```ts
526522
declare module "react-router-dom" {
527523
import * as React from 'react';
@@ -536,8 +532,6 @@ declare module "react-router-dom" {
536532
// ...
537533
```
538534
539-
For more information on creating type definitions for class components, you can refer to this [post](https://templecoding.com/blog/2016/03/31/creating-typescript-typings-for-existing-react-components) for reference.
540-
541535
## Frequent Known Problems with TypeScript
542536
543537
Just a list of stuff that React developers frequently run into, that TS has no solution for. Not necessarily TSX only.

0 commit comments

Comments
 (0)