diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js index c87123c72d..014547cf2d 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js @@ -10,6 +10,10 @@ import is_reference from 'is-reference'; import { dev, is_ignored, locator, component_name } from '../../../../../state.js'; import { build_getter } from '../../utils.js'; +/** + * A utility for extracting complex expressions (such as call expressions) + * from templates and replacing them with `$0`, `$1` etc + */ export class Memoizer { /** @type {Array<{ id: Identifier, expression: Expression }>} */ #sync = []; diff --git a/packages/svelte/src/compiler/validate-options.js b/packages/svelte/src/compiler/validate-options.js index 0e24f5110a..ed83375d22 100644 --- a/packages/svelte/src/compiler/validate-options.js +++ b/packages/svelte/src/compiler/validate-options.js @@ -245,19 +245,6 @@ function validator(fallback, fn) { }; } -/** - * @param {number} fallback - * @returns {Validator} - */ -function number(fallback) { - return validator(fallback, (input, keypath) => { - if (typeof input !== 'number') { - throw_error(`${keypath} should be a number, if specified`); - } - return input; - }); -} - /** * @param {string | undefined} fallback * @param {boolean} allow_empty @@ -277,20 +264,6 @@ function string(fallback, allow_empty = true) { }); } -/** - * @param {string[]} fallback - * @returns {Validator} - */ -function string_array(fallback) { - return validator(fallback, (input, keypath) => { - if (input && !Array.isArray(input)) { - throw_error(`${keypath} should be a string array, if specified`); - } - - return input; - }); -} - /** * @param {boolean | undefined} fallback * @returns {Validator}