Skip to content

Commit 460d91e

Browse files
committed
Fix marketing app typecheck setup
- Run `astro sync` before `astro check` - Add Astro client types and explicit typings in `index.astro`
1 parent 772b197 commit 460d91e

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

apps/marketing/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "astro dev",
88
"build": "astro build",
99
"preview": "astro preview",
10-
"typecheck": "astro check"
10+
"typecheck": "astro sync && astro check"
1111
},
1212
"dependencies": {
1313
"astro": "^6.0.4"

apps/marketing/src/pages/index.astro

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ const themeIdeas = [
410410
return null;
411411
}
412412

413-
function pickAsset(assets, platform) {
413+
function pickAsset(assets: {name: string; browser_download_url: string}[], platform: {os: string; label: string; arch?: string}) {
414414
if (platform.os === "win") {
415415
return assets.find((a) => a.name.endsWith("-x64.exe"))?.browser_download_url ?? null;
416416
}
@@ -426,7 +426,7 @@ const themeIdeas = [
426426
}
427427

428428
function initDownloadButton() {
429-
const btn = document.getElementById("download-btn");
429+
const btn = document.getElementById("download-btn") as HTMLAnchorElement | null;
430430
const label = document.getElementById("download-label");
431431
if (!btn || !label) return;
432432

@@ -437,7 +437,7 @@ const themeIdeas = [
437437
label.textContent = platform.label;
438438

439439
fetchLatestRelease()
440-
.then((release) => {
440+
.then((release: any) => {
441441
const url = pickAsset(release.assets ?? [], platform);
442442
if (url) {
443443
btn.href = url;
@@ -458,17 +458,17 @@ const themeIdeas = [
458458
const panels = Array.from(group.querySelectorAll("[data-tab-panel]"));
459459
const heroOverlay = group.querySelector("[data-hero-overlay]");
460460

461-
const activate = (id) => {
461+
const activate = (id: string) => {
462462
buttons.forEach((button) => {
463463
const isActive = button.getAttribute("data-tab-target") === id;
464464
button.setAttribute("aria-selected", isActive ? "true" : "false");
465-
button.dataset.active = isActive ? "true" : "false";
465+
(button as HTMLElement).dataset.active = isActive ? "true" : "false";
466466
});
467467

468468
panels.forEach((panel) => {
469469
const isActive = panel.getAttribute("data-tab-panel") === id;
470-
panel.hidden = !isActive;
471-
panel.dataset.active = isActive ? "true" : "false";
470+
(panel as HTMLElement).hidden = !isActive;
471+
(panel as HTMLElement).dataset.active = isActive ? "true" : "false";
472472
});
473473

474474
group.setAttribute("data-active-tab", id);

apps/marketing/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"extends": "astro/tsconfigs/strict"
2+
"extends": "astro/tsconfigs/strict",
3+
"compilerOptions": {
4+
"types": ["astro/client"]
5+
},
6+
"include": ["src", "**/*.ts", "**/*.tsx", "**/*.astro", ".astro/types.d.ts"]
37
}

0 commit comments

Comments
 (0)