|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { isSnippet } from './dom/blocks/snippet.js';
|
|
|
|
|
import { is_snippet } from './dom/blocks/snippet.js';
|
|
|
|
|
import { untrack } from './runtime.js';
|
|
|
|
|
import { is_array } from './utils.js';
|
|
|
|
|
|
|
|
|
@ -109,7 +109,7 @@ export function loop_guard(timeout) {
|
|
|
|
|
* @param {any} snippet_fn
|
|
|
|
|
*/
|
|
|
|
|
export function validate_snippet(snippet_fn) {
|
|
|
|
|
if (snippet_fn && !isSnippet(snippet_fn)) {
|
|
|
|
|
if (snippet_fn && !is_snippet(snippet_fn)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
'The argument to `{@render ...}` must be a snippet function, not a component or some other kind of function. ' +
|
|
|
|
|
'If you want to dynamically render one snippet or another, use `$derived` and pass its result to `{@render ...}`.'
|
|
|
|
@ -123,7 +123,7 @@ export function validate_snippet(snippet_fn) {
|
|
|
|
|
* @param {any} component_fn
|
|
|
|
|
*/
|
|
|
|
|
export function validate_component(component_fn) {
|
|
|
|
|
if (isSnippet(component_fn)) {
|
|
|
|
|
if (is_snippet(component_fn)) {
|
|
|
|
|
throw new Error('A snippet must be rendered with `{@render ...}`');
|
|
|
|
|
}
|
|
|
|
|
return component_fn;
|
|
|
|
|