Skip to content

Commit

Permalink
Merge pull request #23668 from Expensify/tgolen-patch-3
Browse files Browse the repository at this point in the history
[No QA] Improve instructions for migrating away from underscore
  • Loading branch information
roryabraham authored Jul 26, 2023
2 parents fd887bd + ff0b28e commit 0d98268
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion contributingGuides/TS_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,23 @@ declare module "external-library-name" {
- If you're migrating a module that doesn't have a default implementation (i.e. `index.ts`, e.g. `getPlatform`), convert `index.website.js` to `index.ts`. Without `index.ts`, TypeScript cannot get type information where the module is imported.
- Deprecate the usage of `underscore`. Use the corresponding methods from `lodash`. eslint: [`no-restricted-imports`](https://eslint.org/docs/latest/rules/no-restricted-imports)
- Deprecate the usage of `underscore`. Use vanilla methods from JS instead. Only use `lodash` when there is no easy vanilla alternative (eg. `lodashMerge`). eslint: [`no-restricted-imports`](https://eslint.org/docs/latest/rules/no-restricted-imports)
```ts
// BAD
var arr = [];
_.each(arr, () => {});

// GOOD
var arr = [];
arr.forEach(() => {});

// BAD
lodashGet(object, ['foo'], 'bar');

// GOOD
object?.foo ?? 'bar';
```
- Found type bugs. Now what?
Expand Down

0 comments on commit 0d98268

Please sign in to comment.