Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(website): improve types
Elian Doranf0ce72898268
diff --git a/apps/website/src/lib/download-helper.ts b/apps/website/src/lib/download-helper.tsindex f01aa15ea2..0f96428760 100644--- a/apps/website/src/lib/download-helper.ts+++ b/apps/website/src/lib/download-helper.ts@@ -1,5 +1,7 @@import rootPackageJson from '../../../../package.json';+type App = "desktop";+export type Architecture = 'x64' | 'arm64';export type Platform = 'mac' | 'windows' | 'linux';@@ -10,8 +12,16 @@ export function buildDesktopDownloadUrl(platform: Platform, format: string, archreturn `https://github.com/TriliumNext/Notes/releases/download/${version}/TriliumNextNotes-${version}-${platform}-${architecture}.${format}`;}+interface DownloadMatrixEntry {+ title: Record<Architecture, string>;+ description: Record<Architecture, string>;+ downloads: Record<string, { recommended?: boolean; name: string }>;+}++type DownloadMatrix = Record<App, Record<Platform, DownloadMatrixEntry>>;+// Keep compatibility info inline with https://github.com/electron/electron/blob/main/README.md#platform-support.-export const downloadMatrix = {+export const downloadMatrix: DownloadMatrix = {desktop: {windows: {title: {diff --git a/apps/website/src/routes/download/+page.svelte b/apps/website/src/routes/download/+page.svelteindex b26bbb4d18..4cf09f2a8f 100644--- a/apps/website/src/routes/download/+page.svelte+++ b/apps/website/src/routes/download/+page.svelte@@ -2,7 +2,7 @@import type { Platform } from "$lib/download-helper";import { buildDesktopDownloadUrl, downloadMatrix, getArchitecture } from "$lib/download-helper";- let architectures = ["x64", "arm64"];+ let architectures = ["x64", "arm64"] as const;let architecture = getArchitecture();</script>