Closed MajorLift closed 1 day ago
As we are going through other work we should be on the lookout for places to replace Type Annotations with satisfies. Typescript guidelines should give indicators for when to use satisfies
There are currently 135 Type Annotations in core.
@MajorLift will do a bit more investigation and we will revisit as part of next refinement.
Type annotations count in core as of 3/21/2024 (test files excluded):
const \S+:
: 136 resultslet \S+:
: 46 results
The next version bump for TypeScript in
core
andmetamask-module-template
will mark an update to version 4.9, which will make thesatisfies
operator keyword available for use (https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#satisfies).The
satisfies
operator is a safer alternative to type annotations (val: T
) and type assertions (val as T
). We should investigate opportunities to improve type safety in the codebase by applying this feature to existing code.