Home / File/ on-mount.ts — svelte Source File

on-mount.ts — svelte Source File

Architecture documentation for on-mount.ts, a typescript file in the svelte codebase. 1 imports, 0 dependents.

File typescript 1 imports

Entity Profile

Dependency Diagram

graph LR
  8e81215a_8802_5f1e_e671_b32f9b73e6d4["on-mount.ts"]
  4ead6623_c53e_ab40_5690_64903d5addf1["svelte"]
  8e81215a_8802_5f1e_e671_b32f9b73e6d4 --> 4ead6623_c53e_ab40_5690_64903d5addf1
  style 8e81215a_8802_5f1e_e671_b32f9b73e6d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { onMount } from 'svelte';

// sync and no return
onMount(() => {
	console.log('mounted');
});

// sync and return value
onMount(() => {
	return 'done';
});

// sync and return sync
onMount(() => {
	return () => {
		return 'done';
	};
});

// sync and return async
onMount(() => {
	return async () => {
		const res = await fetch('');
		return res;
	};
});

// async and no return
onMount(async () => {
	await fetch('');
});

// async and return value
onMount(async () => {
	const res = await fetch('');
	return res;
});

// @ts-expect-error async and return sync
onMount(async () => {
	return () => {
		return 'done';
	};
});

// @ts-expect-error async and return async
onMount(async () => {
	return async () => {
		const res = await fetch('');
		return res;
	};
});

// async and return any
onMount(async () => {
	const a: any = null as any;
	return a;
});

// async and return function casted to any
// can't really catch this without also catching above
onMount(async () => {
	const a: any = (() => {}) as any;
	return a;
});

Dependencies

  • svelte

Frequently Asked Questions

What does on-mount.ts do?
on-mount.ts is a source file in the svelte codebase, written in typescript.
What does on-mount.ts depend on?
on-mount.ts imports 1 module(s): svelte.
Where is on-mount.ts in the architecture?
on-mount.ts is located at packages/svelte/tests/types/on-mount.ts (directory: packages/svelte/tests/types).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free