Skip to content

Commit b1385fc

Browse files
committed
minor edits
1 parent 9983a5a commit b1385fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/typescript.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ When a type assertion is used with a clear rationale, we should document the rea
420420
};
421421
422422
export const STATIC_MAINNET_TOKEN_LIST = Object.entries(
423-
// This type assertion is to the known schema of the JSON object `contract-metadata.json`.
423+
// This type assertion is to the known schema of the JSON object `contractMap`.
424424
contractMap as Record<Hex, LegacyToken>,
425425
).reduce((acc, [base, contract]) => {
426426
const { name, symbol, decimals, logo, erc721 } = contract;
@@ -526,7 +526,7 @@ When a type assertion is used with a clear rationale, we should document the rea
526526

527527
### Escape Hatches
528528

529-
TypeScript provides several escape hatches that disable compiler type checks altogether and suppress compiler errors. Using these to ignore typing issues is dangerous and reduces the effectiveness of TypeScript. The following are presented in order of preference for usage.
529+
TypeScript provides several escape hatches that disable compiler type checks altogether and suppress compiler errors. Using these to ignore typing issues is dangerous and reduces the effectiveness of TypeScript.
530530

531531
- `@ts-expect-error`
532532
- Applies to a single line, which may contain multiple variables and errors.
@@ -549,7 +549,7 @@ TypeScript provides several escape hatches that disable compiler type checks alt
549549
- Does not propagate to instances of the target variable or type that are outside of its scope.
550550
- Banned by the `@typescript-eslint/ban-ts-comment` rule.
551551

552-
- `any`:
552+
- `any`
553553
- Applies to all instances of the target variable or type throughout the entire codebase, and in downstream code as well.
554554
- Has the same effect as applying `@ts-ignore` to every single instance of the target variable or type.
555555
- Banned by the `@typescript-eslint/no-explicit-any` rule.
@@ -634,7 +634,7 @@ This recommendation applies to any disruptive change that creates many errors at
634634

635635
See [this entry](https://github.com/MetaMask/core/blob/main/docs/package-migration-process-guide.md#4-resolve-or-todo-downstream-errors) in the core repo "package migration process guide," which recommends that complex or blocked errors should be annotated with a `// @ts-expect-error TODO:` comment, and then revisited once the disruptive change has been completed.
636636

637-
#### Always avoid `any`
637+
#### Avoid `any`
638638

639639
`any` is the most dangerous form of explicit type declaration, and should be completely avoided.
640640

0 commit comments

Comments
 (0)