Repository navigation
Conversation
openwrt-ai
reviewed
Oct 8, 2026
Document the class argument as a constructor of T and the result as T, so tools reading the JSDoc see section(), option() and taboption() return an instance of the class passed in, not of the base class. Type SectionValue's subsection_class as a constructor too. Signed-off-by: Victor Irzak <victor@irzak.com>
virzak
force-pushed
the
luci-base-jsdoc-generics
branch
from
October 8, 2026 08:17
2cc3c03 to
692cd5c
Compare
openwrt-ai
reviewed
Oct 9, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request details
Description
Follow-up to #9100.
section(),option()andtaboption()take a class and return an instance of it, but their JSDoc types the argument as an instance of the base class and the result as the base class. This documents the argument as{function(new:T, ...*)}(Closure syntax, whichjsdoc.conf.jsonalready enables) and the result as{T}, via@template T.Generated TypeScript declarations then become
option<T>(cbiClass: new (...args: any[]) => T, ...args: any[]): T, so a view gets back the class it passed (form.Value,form.ListValue, ...) instead ofAbstractValue. This is the remaining JSDoc gap for #9101: with it, the status-light settings page type-checks in strict mode against declarations generated from master with no local corrections.jsdocparses and renders without errors (taboption(tabName, cbiClass, ...args) -> {T}), and eslint reports nothing new forform.js. The prose still names AbstractSection and AbstractValue as the required base classes.Maintainer (preferred)
@systemcrash
Tested on
Documentation only; no code changes.