Improve JSDocs to help with type inference
Categories
(WebExtensions :: General, task, P3)
Tracking
(firefox123 fixed)
Tracking | Status | |
---|---|---|
firefox123 | --- | fixed |
People
(Reporter: zombie, Assigned: zombie)
References
(Blocks 1 open bug)
Details
(Whiteboard: [addons-jira])
Attachments
(3 files, 1 obsolete file)
We have documented many of our functions and classes using JSDocs, but because no system actually tries to use (or test) those types, many of them are often slightly "wrong".
Assignee | ||
Comment 1•7 months ago
|
||
Assignee | ||
Comment 2•7 months ago
|
||
These fall under 5 main categories:
-
Declare and/or initialize all class fiels in the constructor.
(general good practise) -
Use real getters and redefineLazyGetter instead of defineLazyGetter.
(also keeps related code closer together) -
When subclassing, don't override class fields with getters (or vice versa).
https://github.com/microsoft/TypeScript/pull/33509 -
Declare and assign object literals at the same time, not separatelly.
(don't uselet foo;
at the top of the file, usevar foo = {
) -
Don't re-use local variables unnecesarily with different types.
(general good practise, local variables are "free")
Depends on D196385
Assignee | ||
Comment 3•7 months ago
|
||
Depends on D196386
Assignee | ||
Comment 4•7 months ago
|
||
Depends on D196387
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Updated•7 months ago
|
Assignee | ||
Updated•7 months ago
|
Updated•7 months ago
|
Comment 5•6 months ago
|
||
Comment on attachment 9368580 [details]
Bug 1869678 - Add tsconfig, basic types, and fix or ignore remaining type errors r?rpl,robwu
Revision D196388 was moved to bug 1871127. Setting attachment 9368580 [details] to obsolete.
Pushed by tjovanovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1c6e48c2b096 Fixup and improve JSDocs for better type inference r=robwu https://hg.mozilla.org/integration/autoland/rev/8e768446e17c Use more idiomatic code patterns for better type inference r=robwu https://hg.mozilla.org/integration/autoland/rev/81e9c0d20939 Fix misc bugs identified by type inference r=robwu
Comment 7•6 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/1c6e48c2b096
https://hg.mozilla.org/mozilla-central/rev/8e768446e17c
https://hg.mozilla.org/mozilla-central/rev/81e9c0d20939
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/3b127f7cce0f adjust Thunderbird jsdoc to be valid after bug 1869678. rs=eslint
Description
•