diff options
| author | binarycat <binarycat@envs.net> | 2025-06-09 15:33:30 -0500 |
|---|---|---|
| committer | binarycat <binarycat@envs.net> | 2025-06-26 12:16:35 -0500 |
| commit | 3b259ad33c8257944bf7069d3c6f463393bf7bc4 (patch) | |
| tree | e1fdaa65b92b7218ae29d3cd044f746c24c6d768 /src/librustdoc/html/static/js/rustdoc.d.ts | |
| parent | 42245d34d22ade32b3f276dcf74deb826841594c (diff) | |
| download | rust-3b259ad33c8257944bf7069d3c6f463393bf7bc4.tar.gz rust-3b259ad33c8257944bf7069d3c6f463393bf7bc4.zip | |
rustdoc js: several typechecking improvments
non-exhaustive list of changes: * rustdoc.Results has a max_dist field * improve typechecking around pathDist and addIntoResults * give handleNameSearch a type signature * typecheck sortQ * currentCrate is string and not optional * searchState is referenced as a global, not through window
Diffstat (limited to 'src/librustdoc/html/static/js/rustdoc.d.ts')
| -rw-r--r-- | src/librustdoc/html/static/js/rustdoc.d.ts | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/librustdoc/html/static/js/rustdoc.d.ts b/src/librustdoc/html/static/js/rustdoc.d.ts index 6af16441de8..bbcd96040be 100644 --- a/src/librustdoc/html/static/js/rustdoc.d.ts +++ b/src/librustdoc/html/static/js/rustdoc.d.ts @@ -4,6 +4,8 @@ /* eslint-disable */ declare global { + /** Search engine data used by main.js and search.js */ + declare var searchState: rustdoc.SearchState; /** Defined and documented in `storage.js` */ declare function nonnull(x: T|null, msg: string|undefined); /** Defined and documented in `storage.js` */ @@ -17,8 +19,6 @@ declare global { RUSTDOC_TOOLTIP_HOVER_MS: number; /** Used by the popover tooltip code. */ RUSTDOC_TOOLTIP_HOVER_EXIT_MS: number; - /** Search engine data used by main.js and search.js */ - searchState: rustdoc.SearchState; /** Global option, with a long list of "../"'s */ rootPath: string|null; /** @@ -102,20 +102,22 @@ declare namespace rustdoc { currentTab: number; focusedByTab: [number|null, number|null, number|null]; clearInputTimeout: function; - outputElement: function(): HTMLElement|null; - focus: function(); - defocus: function(); - showResults: function(HTMLElement|null|undefined); - removeQueryParameters: function(); - hideResults: function(); - getQueryStringParams: function(): Object.<any, string>; + outputElement(): HTMLElement|null; + focus(); + defocus(); + // note: an optional param is not the same as + // a nullable/undef-able param. + showResults(elem?: HTMLElement|null); + removeQueryParameters(); + hideResults(); + getQueryStringParams(): Object.<any, string>; origPlaceholder: string; setup: function(); - setLoadingSearch: function(); + setLoadingSearch(); descShards: Map<string, SearchDescShard[]>; loadDesc: function({descShard: SearchDescShard, descIndex: number}): Promise<string|null>; - loadedDescShard: function(string, number, string); - isDisplayed: function(): boolean, + loadedDescShard(string, number, string); + isDisplayed(): boolean, } interface SearchDescShard { @@ -237,7 +239,7 @@ declare namespace rustdoc { query: ParsedQuery, } - type Results = Map<String, ResultObject>; + type Results = { max_dist?: number } & Map<number, ResultObject> /** * An annotated `Row`, used in the viewmodel. |
