(moduleNs: unknown)
| 150 | } |
| 151 | |
| 152 | function 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 | |
| 164 | function coerceRoutesExport<S>(value: unknown): readonly RouteDefinition<S>[] { |
| 165 | if (!Array.isArray(value)) { |
nothing calls this directly
no test coverage detected