diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /toolkit/components/extensions/types/README.md | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/types/README.md')
-rw-r--r-- | toolkit/components/extensions/types/README.md | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/toolkit/components/extensions/types/README.md b/toolkit/components/extensions/types/README.md index ebd01dec60..1d4588389c 100644 --- a/toolkit/components/extensions/types/README.md +++ b/toolkit/components/extensions/types/README.md @@ -21,11 +21,11 @@ viability and benefits of doing this for a "typical" component. ## How to use and expectations -Use [npm or yarn to install][download] TypeScript. -Then run `tsc` in the extensions directory to check types: +Mach now comes with a `ts` command for type checking code using the built-in +gecko typelibs: ``` -mozilla-central/toolkit/components/extensions $ tsc +mozilla-central $ ./mach ts check toolkit/components/extensions/ ``` You can also use an editor which supports the [language server][langserv]. @@ -64,6 +64,9 @@ These fall under 5 main categories: 5) Don't re-use local variables unnecessarily with different types. * (general good practice, local variables are "free") + 6) Use `export` on individual classes instead of grouping into "namespaces". + * (idiomatic/ergonomic/modern JS, grouping was a leftover from JSMs) + ### @ts-ignore recommendations *Don't* use `@ts-ignore` for class fields and function or method signatures. @@ -75,7 +78,7 @@ These fall under 5 main categories: parts of the codebase. -[handbook]: https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html +[handbook]: https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html [jsdoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html |