From 33886cf39bd8c128296834a6825992f8b8341fe7 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 22 Dec 2023 20:23:12 -0500 Subject: API type safety (#425) * Improve API type safety * Update init * Update type names * Simplify init --- ext/js/accessibility/google-docs.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ext/js/accessibility') 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} + * @template {import('api').ApiNames} TAction + * @template {import('api').ApiParams} TParams + * @param {TAction} action + * @param {TParams} params + * @returns {Promise>} */ 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}); -- cgit v1.2.3