MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / defaultResolveView

Function defaultResolveView

packages/node/src/dev/hotStateReload.ts:152–162  ·  view source on GitHub ↗
(moduleNs: unknown)

Source from the content-addressed store, hash-verified

150}
151
152function defaultResolveView<S>(moduleNs: unknown): ViewFn<S> {
153 if (!isRecord(moduleNs)) {
154 throw new Error("HSR module must export a named `view` function or a default function");
155 }
156 const moduleExports = moduleNs as { view?: unknown; default?: unknown };
157 const named = moduleExports.view;
158 if (typeof named === "function") return named as ViewFn<S>;
159 const fallback = moduleExports.default;
160 if (typeof fallback === "function") return fallback as ViewFn<S>;
161 throw new Error("HSR module must export a named `view` function or a default function");
162}
163
164function coerceRoutesExport<S>(value: unknown): readonly RouteDefinition<S>[] {
165 if (!Array.isArray(value)) {

Callers

nothing calls this directly

Calls 1

isRecordFunction · 0.70

Tested by

no test coverage detected