Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Nov 28, 2022
1 parent 62facb6 commit 8f42164
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/kit/src/runtime/client/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ const valid_link_options = /** @type {const} */ ({

/**
* @template {LinkOptionName} T
* @template {typeof valid_link_options[T][number] | null} U
* @param {Element} element
* @param {T} name
* @returns {U}
*/
function link_option(element, name) {
const value = /** @type {U} */ (element.getAttribute(`data-sveltekit-${name}`));
return __SVELTEKIT_DEV__ ? validate_attribute_value(element, name, value) : value;
const value = /** @type {typeof valid_link_options[T][number] | null} */ (
element.getAttribute(`data-sveltekit-${name}`)
);

return __SVELTEKIT_DEV__ ? validate_link_option(element, name, value) : value;
}

/**
Expand All @@ -53,9 +54,8 @@ function link_option(element, name) {
* @param {Element} element
* @param {T} name
* @param {U} value
* @returns {U}
*/
function validate_attribute_value(element, name, value) {
function validate_link_option(element, name, value) {
if (warned.has(element) || value === null) return /** @type {U} */ (null);

// @ts-expect-error - includes is dumb
Expand Down

0 comments on commit 8f42164

Please sign in to comment.