-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit d504b33
TypeScript Guidelines - Types: Inference, Annotations, Assertions, Escape Hatches (#74)
## Motivation
In order to improve type safety and maintainability, we need to
establish clear guidelines regarding how to apply types: specifically,
when and when not to use explicit type declarations or keywords such as
`as`, `any`.
## Explanation
- See markdown preview: [TypeScript Guidelines - "Types"
section](https://github.com/MetaMask/contributor-docs/blob/240206-typescript-guidelines-any-as/docs/typescript.md)
- ~The merge conflicts with main will be resolved after the review
process to avoid noisy diffs.~
- All examples are tagged with a permalink for easy reference and
quotation.
### Table of Contents
- Types
- Type Inference
- Type Annotations (`:`, `satisfies`)
- Type Assertions (`as`, `!`)
- Escape Hatches (`any`, `@ts-expect-error`)
### Details
- Dangers and advantages.
- Tips for avoiding.
- Acceptable use cases.
## References
- Closes #47
- Closes #57
- Contributes to #69
---------
Co-authored-by: Mark Stacey <[email protected]>
Co-authored-by: Elliot Winkler <[email protected]>1 parent 27fcb6e commit d504b33Copy full SHA for d504b33
1 file changed
+905
-109
lines changed
0 commit comments