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: MIGRATING.md
+14-4Lines changed: 14 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,23 @@ This Cheatsheet collates advice and utilities from real case studies of teams mo
6
6
7
7
## General Conversion approaches
8
8
9
+
- Level 0: Don't use TypeScript, use JSDoc
10
+
- See our [JSDoc section](#JSDoc)
11
+
- Level 1: Unstrict TypeScript
12
+
-`"noImplicitAny": false`
13
+
- "[Just rename all .js files to .ts](https://twitter.com/jamonholmgren/status/1089241726303199232)"
14
+
- consider using `allowJS`? (Source: [clayallsop][clayallsop], [pleo][pleo])
15
+
- Level 2: Strict TypeScript
16
+
- use Microsoft's [`dts-gen`](https://github.com/Microsoft/dts-gen) to generate `.d.ts` files for your untyped files. [This SO answer](https://stackoverflow.com/questions/12687779/how-do-you-produce-a-d-ts-typings-definition-file-from-an-existing-javascript) has more on the topic.
17
+
- use `declare` keyword for ambient declarations
18
+
19
+
20
+
Misc tips/approaches successful companies have taken
21
+
9
22
-`@ts-ignore` on compiler errors for libraries with no typedefs
10
23
- pick ESLint over TSLint ([source](https://eslint.org/blog/2019/01/future-typescript-eslint))
11
24
- New code must always be written in TypeScript. No exceptions. For existing code: If your task requires you to change JavaScript code, you need to rewrite it. (Source: [Hootsuite][hootsuite])
12
-
- consider using `allowJS`? (Source: [clayallsop][clayallsop], [pleo][pleo])
13
-
- consider `"noImplicitAny": false` if you need a gentler onboarding
14
-
- use Microsoft's [`dts-gen`](https://github.com/Microsoft/dts-gen) to generate `.d.ts` files for your untyped files. [This SO answer](https://stackoverflow.com/questions/12687779/how-do-you-produce-a-d-ts-typings-definition-file-from-an-existing-javascript) has more on the topic.
0 commit comments