lib: add JSDoc typings for util#38213
Conversation
|
No need to fix all the checkJs errors for now! it is going to be an iterative process that will get easier as more types are added throughout core. |
Co-authored-by: Bradley Farias <bradley.meck@gmail.com>
Co-authored-by: Bradley Farias <bradley.meck@gmail.com>
This comment has been minimized.
This comment has been minimized.
Ref: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#-deprecated--support Co-authored-by: akhil marsonya <16393876+marsonya@users.noreply.github.com>
Added |
It is supported by TypeScript but the goal of JSDoc in core files is not to duplicate the public-facing documentation. Maybe it's fine in this case, because we don't use these functions in core, but we have to be careful about this (avoid too much duplication, focus on typings and other small changes that help core developers). |
PR-URL: #38213 Refs: #38182 Refs: https://twitter.com/bradleymeck/status/1380643627211354115 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 767d91b |
PR-URL: #38213 Refs: #38182 Refs: https://twitter.com/bradleymeck/status/1380643627211354115 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #38213 Refs: #38182 Refs: https://twitter.com/bradleymeck/status/1380643627211354115 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #38213 Refs: #38182 Refs: https://twitter.com/bradleymeck/status/1380643627211354115 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #38213 Refs: #38182 Refs: https://twitter.com/bradleymeck/status/1380643627211354115 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Ref: #38182
Ref: https://twitter.com/bradleymeck/status/1380643627211354115
Added JSDoc typings to
lib/util. Most of the typings are pretty simple and direct, all theisThingmethods have been typed using type predicates.callbackifyis a bit complex, for this I used the new Leading Rest elements in tuple types to infer types.Before:
After:
There are still some errors with
checkJsenabled that I'm not sure how to fix since we are mutating the original type: