Commit c70c9412 authored by Alejandro Celaya's avatar Alejandro Celaya Committed by Alejandro Celaya

Migrate config-func-settings-from to TypeScript

parent ab6be482
import { hasOwn } from '../../shared/has-own'; import { hasOwn } from '../../shared/has-own';
/** type HypothesisWindowProps = {
* @typedef HypothesisWindowProps /** Function that returns configuration for the Hypothesis client */
* @prop {() => Record<string, unknown>} [hypothesisConfig] - Function that returns configuration hypothesisConfig?: () => Record<string, unknown>;
* for the Hypothesis client };
*/
/** /**
* Return an object containing config settings from window.hypothesisConfig(). * Return an object containing config settings from window.hypothesisConfig().
...@@ -20,10 +19,12 @@ import { hasOwn } from '../../shared/has-own'; ...@@ -20,10 +19,12 @@ import { hasOwn } from '../../shared/has-own';
* *
* If there's no window.hypothesisConfig() function then return {}. * If there's no window.hypothesisConfig() function then return {}.
* *
* @param {Window & HypothesisWindowProps} window_ - The window to search for a hypothesisConfig() function * @param window_ - The window to search for a hypothesisConfig() function
* @return {Record<string, unknown>} - Any config settings returned by hypothesisConfig() * @return Any config settings returned by hypothesisConfig()
*/ */
export function configFuncSettingsFrom(window_) { export function configFuncSettingsFrom(
window_: Window & HypothesisWindowProps
): Record<string, unknown> {
if (!hasOwn(window_, 'hypothesisConfig')) { if (!hasOwn(window_, 'hypothesisConfig')) {
return {}; return {};
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment