diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2023-12-22 20:23:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-23 01:23:12 +0000 |
commit | 33886cf39bd8c128296834a6825992f8b8341fe7 (patch) | |
tree | 1d5e8245f1d372d8ba89f93e4d0c9787c50d4468 /ext/js/accessibility/google-docs.js | |
parent | f320e2dd5d7fe7c0ada7ec9634bd060c73cc3986 (diff) |
API type safety (#425)
* Improve API type safety
* Update init
* Update type names
* Simplify init
Diffstat (limited to 'ext/js/accessibility/google-docs.js')
-rw-r--r-- | ext/js/accessibility/google-docs.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/js/accessibility/google-docs.js b/ext/js/accessibility/google-docs.js index 27841b6d..4bc398ff 100644 --- a/ext/js/accessibility/google-docs.js +++ b/ext/js/accessibility/google-docs.js @@ -24,10 +24,11 @@ self.googleDocsAccessibilitySetup = true; /** - * @template [TReturn=unknown] - * @param {string} action - * @param {import('core').SerializableObject} params - * @returns {Promise<TReturn>} + * @template {import('api').ApiNames} TAction + * @template {import('api').ApiParams<TAction>} TParams + * @param {TAction} action + * @param {TParams} params + * @returns {Promise<import('api').ApiReturn<TAction>>} */ const invokeApi = (action, params) => { return new Promise((resolve, reject) => { @@ -45,7 +46,7 @@ }; const optionsContext = {depth: 0, url: location.href}; - /** @type {import('api').OptionsGetResult} */ + /** @type {import('api').ApiReturn<'optionsGet'>} */ let options; try { options = await invokeApi('optionsGet', {optionsContext}); |