Skip to content

Commit 64c801f

Browse files
Merge branch 'main' into modernization
2 parents 283d059 + 850e2a4 commit 64c801f

30 files changed

Lines changed: 8 additions & 3040 deletions

.github/ISSUE_TEMPLATE/migrating-cheatsheet.md

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

README.md

Lines changed: 1 addition & 997 deletions
Large diffs are not rendered by default.

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: 3 additions & 23 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

@@ -188,7 +168,7 @@ Any other tips? Please contribute on this topic! [We have an ongoing issue here
188168
Compiling large TS projects can get slow. Here are some tips:
189169

190170
- We have a dedicated repo tracking TS speed recommendations: https://github.com/typescript-cheatsheets/speed
191-
- Use [TS 3.0 Project references](https://react-typescript-cheatsheet.netlify.app/docs/advanced/patterns_by_version#typescript-30)
171+
- Use [TypeScript Project references](https://www.typescriptlang.org/docs/handbook/project-references.html)
192172
- Check the official [TS performance wiki guidelines](https://github.com/microsoft/TypeScript/wiki/Performance) - note that [Dan Rossenwasser says to take it with a grain of salt](https://news.ycombinator.com/item?id=25199070)
193173
- Webpack ([see CRA diff](https://gist.github.com/jaredpalmer/d3016701589f14df8a3572df91a5754b)):
194174
- set `output.pathinfo = false`

docs/advanced/patterns_by_usecase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ ReactDOM.render(
245245
);
246246
```
247247

248-
As of [TS 2.9](#typescript-29), you can also supply the type parameter in your JSX to opt out of type inference:
248+
You can also supply the type parameter in your JSX to opt out of type inference:
249249

250250
```tsx
251251
ReactDOM.render(

0 commit comments

Comments
 (0)