Skip to content

TypeScript Guidelines - Types: Inference, Annotations, Assertions, Escape Hatches #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 93 commits into from
Apr 30, 2024
Merged
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
b9644ca
Add `Types` section
MajorLift Feb 29, 2024
6e3a689
Add `TransactionMeta` example to 'Type Inference' section
MajorLift Mar 1, 2024
f59b25c
In code blocks, prefer full language name over abbreviation
MajorLift Mar 1, 2024
513a52a
Add more info on `unknown`/`never` as `any` substitutes
MajorLift Mar 1, 2024
4e6db20
Reordering
MajorLift Mar 1, 2024
a96266a
Fix heading level
MajorLift Mar 1, 2024
7a9a395
Remove unnecessary heading
MajorLift Mar 1, 2024
d2bb458
Add entry on redundant `as` assertions
MajorLift Mar 1, 2024
3e8f18a
Rewrite intro to type inference section
MajorLift Mar 1, 2024
dc3c902
Closes https://github.com/MetaMask/contributor-docs/issues/57
MajorLift Mar 1, 2024
429f1ba
Change heading title, level
MajorLift Mar 1, 2024
39795dc
Proofread: first pass
MajorLift Mar 3, 2024
2b2fcb7
Consolidate redundant entries on avoiding destructive annotations
MajorLift Mar 3, 2024
a68f248
Add type guard predicate example
MajorLift Mar 4, 2024
2438fd4
Add example for following compiler hints for assertions
MajorLift Mar 4, 2024
ad8f0fe
Add entry on infectious `any` surface area
MajorLift Mar 4, 2024
ebd1e9f
Edits
MajorLift Mar 4, 2024
e7cae45
Add exception case for avoiding type annotations
MajorLift Mar 4, 2024
7f5dbaf
Add intro for Types section
MajorLift Mar 5, 2024
521bbff
New entry specifying annotations to be preferable over assertions
MajorLift Mar 5, 2024
e3d2657
Move type guards entry into assertions section
MajorLift Mar 5, 2024
6f3c3b1
Rename type narrowing section to type annotations
MajorLift Mar 5, 2024
2f1be2b
Edit intro
MajorLift Mar 5, 2024
9e1ca30
Edit infectious `any` entry wording
MajorLift Mar 5, 2024
6ca70eb
Add entry on `satisfies` and definition vs. constraint
MajorLift Mar 6, 2024
e19ee15
Add example for `satisfies`
MajorLift Mar 7, 2024
a6c27c6
Edit type inference section
MajorLift Mar 7, 2024
fd731a9
Edit assertions section
MajorLift Mar 7, 2024
59ef116
Rewrite avoid any section, add example for type subsuming
MajorLift Mar 7, 2024
c77aa03
Add caveat for never substituting any
MajorLift Mar 7, 2024
5089f18
Rewrite all guideline entry titles as self-contained rules
MajorLift Mar 7, 2024
d6b2d71
Add error messages for `satisfies` example
MajorLift Mar 7, 2024
740e14b
Proofread with focus on conciseness
MajorLift Mar 7, 2024
0355df7
Add `any` section explaining necessity of shared understanding of its…
MajorLift Mar 9, 2024
4ca6cf6
Add preface detailing purpose, scope of article
MajorLift Mar 11, 2024
84bf4e5
Add section for `@ts-expect-error`
MajorLift Mar 11, 2024
d65850c
Add disclaimers on whether `any`/`as` acceptable use cases list shoul…
MajorLift Mar 11, 2024
8a6f364
Edit any, as sections
MajorLift Mar 11, 2024
e611441
Edits
MajorLift Mar 12, 2024
5d81b66
Apply suggestions from code review
MajorLift Mar 12, 2024
c22ed98
Edit, reformat introduction section
MajorLift Mar 13, 2024
c7be62d
Add example headings with UUIDs
MajorLift Mar 13, 2024
e98b2b7
Add to compiler directives intro
MajorLift Mar 13, 2024
13f1e95
Add prefer `@ts-expect-error` over `any` entry
MajorLift Mar 13, 2024
c58191e
Apply suggestions from code review
MajorLift Mar 13, 2024
6f22967
Rename "Compiler Directives" section to "Escape Hatches" and add over…
MajorLift Mar 18, 2024
03bdb01
Rewrite `any` section `unknown`/`never` substitution entry. Remove `n…
MajorLift Mar 18, 2024
aadb105
Remove generic type assignment entry
MajorLift Mar 18, 2024
165309b
Add example for avoiding `any` in generic arguments
MajorLift Mar 18, 2024
f627cbc
Remove "Acceptable Usages of `:`" section
MajorLift Mar 18, 2024
3777389
Type annotations edit
MajorLift Mar 18, 2024
2d15797
Remove first sentence
MajorLift Mar 18, 2024
caae0d5
Add new entry on extensible data types and type annotations
MajorLift Mar 18, 2024
58ed378
Add note on `is` assertion in filter call becoming unnecessary in v5.5+
MajorLift Mar 18, 2024
a49fe47
Linter fixes
MajorLift Mar 18, 2024
6b991a6
Move non-type assertion `as` entry outside of "acceptuable usages"
MajorLift Mar 18, 2024
be9ba15
Flip entry phrasing for consistency
MajorLift Mar 19, 2024
8081ea5
Edit type assertions section: extract "prefer over as any" entry, rem…
MajorLift Mar 19, 2024
372c7b3
Replace "default generic argument" with "generic parameter default", …
MajorLift Mar 19, 2024
42d52aa
Apply new example heading format
MajorLift Mar 20, 2024
69918ac
Condensed intro section
MajorLift Mar 20, 2024
f97a8ad
Remove avoid/acceptable headings, examples to h5, entries to h4
MajorLift Mar 21, 2024
decc1be
Edit entry, examples: "Use `@ts-expect-error` to force runtime execut…
MajorLift Mar 21, 2024
c4dcc58
Fix example for type guard entry
MajorLift Mar 21, 2024
d5993e3
Type assertions entry
MajorLift Mar 21, 2024
f3297bd
Edit escape hatches entry
MajorLift Mar 21, 2024
8edd082
Remove `as any` from example
MajorLift Mar 21, 2024
6dc6810
Move "prefer type assertions over any" to "always avoid any" section
MajorLift Mar 21, 2024
3a50e69
any/unknown/never WIP
MajorLift Mar 21, 2024
540e220
Remove h5 heading from all examples
MajorLift Mar 21, 2024
d0e8535
Add three subentries and examples for "document type assertions" entry
MajorLift Mar 21, 2024
6799426
minor edits
MajorLift Mar 21, 2024
0e7bcc1
Add contents and example for `@ts-expect-error TODO:` entry
MajorLift Mar 21, 2024
b06c3e8
Add "continued from previous example" note with link
MajorLift Mar 21, 2024
f2822f6
Expand `as unknown as` entry and move under assertions section
MajorLift Mar 21, 2024
a44864d
Reword "`any` generic parameter default" entry title
MajorLift Mar 21, 2024
1f3206f
Edit intro
MajorLift Mar 21, 2024
c101f99
Move "use type assertion" entries into second half of assertions section
MajorLift Mar 21, 2024
84109cf
Edit escape hatches section
MajorLift Mar 21, 2024
cdb2cea
Edit, condense "avoid any" section
MajorLift Mar 21, 2024
69d7335
minor edits
MajorLift Mar 21, 2024
ae465b8
Edit `satisfies` for validation section
MajorLift Mar 21, 2024
9983a5a
Add version disclaimer for jest example
MajorLift Mar 21, 2024
b1385fc
minor edits
MajorLift Mar 21, 2024
28deaf3
Edit document assertions section
MajorLift Mar 21, 2024
590aa33
Remove unused escape hatches
MajorLift Mar 21, 2024
bf7b2da
Proofread
MajorLift Mar 22, 2024
7a373b6
Add example for acceptable `any` in generic constraint
MajorLift Mar 27, 2024
85e06a3
Add example for infectious nature of `any`
MajorLift Mar 27, 2024
70647ec
Merge branch 'main' into 240206-typescript-guidelines-any-as
MajorLift Apr 24, 2024
dd60065
Edits, add example for fixing any with unknown
MajorLift Apr 24, 2024
a48b5c5
Linter fixes
MajorLift Apr 24, 2024
1809b07
Merge branch 'main' into 240206-typescript-guidelines-any-as
MajorLift Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Loading