Skip to content

Convert to TypeScript - #4

Closed
mathhulk wants to merge 2 commits into
claude/vibrant-faraday-ux7zgr-pagesfrom
claude/vibrant-faraday-ux7zgr-typescript
Closed

mathhulk wants to merge 2 commits into
claude/vibrant-faraday-ux7zgr-pagesfrom
claude/vibrant-faraday-ux7zgr-typescript

Conversation

@mathhulk

Copy link
Copy Markdown
Collaborator

4 of 4 (stacked on the SSG + GitHub Pages PR, so this diff shows only the TypeScript conversion). Retarget to develop once the earlier PRs merge.

What changed

  • Every component and view is now <script setup lang="ts">, with typed props (defineProps<…>()), emits and slots. main, the router, the builder data and the Vite/ESLint configs are .ts too.
  • The tsconfig is strict (via @vue/tsconfig) and adds noUncheckedIndexedAccess and noUnusedLocals/Parameters.
    • Shared types live in src/types.ts.
    • Route meta.title is typed through vue-router's RouteMeta.
    • The mcsrvstat response has its own interface.
  • Icon names are a union derived from the SVG path map, so using an icon that doesn't exist is a compile error.
  • alternate, continue, centered and progress are now real boolean props. Templates pass the bare attribute instead of the string "true".
  • bun run build now runs vue-tsc first, and bun run typecheck runs it on its own. CI type-checks as a separate step.
  • ESLint now uses @vue/eslint-config-typescript (typescript-eslint).

Why TypeScript 6.0 rather than 7: TypeScript 7's native compiler doesn't have a JS API yet. vue-tsc needs one, and typescript-eslint only supports <6.1. Moving to 7 is a version bump once those tools catch up.

Bugs the type checker found

  • Framed.vue bound a classObject that was never defined.
  • Credits.vue used credits as both the prop name and the template ref name.

vite-ssg workaround

vite-ssg's check for <link>s it has already added never matches, because it queries attrs.file, which is always undefined. In this build Rolldown moved the Vue runtime into a shared chunk (the JS is about 2 KB smaller overall, just split differently). As a result Splash's CSS got a second, non-CORS link and was downloaded twice, with a console warning. onPageRendered in vite.config.ts now keeps only the first stylesheet/modulepreload link per URL.

Verification

  • vue-tsc, eslint and the SSG build all pass. The dev server serves .ts and .vue files.
  • Full-page screenshots of /, /campus, /club and a 404 URL are pixel-identical to the previous PR's build. The only exception is the randomly shuffled credits.
  • Built with Vue's hydration-mismatch details turned on: no mismatch warnings and no console errors.
  • Status codes are the same as on GitHub Pages: 200 for real pages, 404 for unknown URLs.
  • The mobile menu, Java/Bedrock toggle, location full screen (each click toggles once, so emits aren't doubled) and credits pause on hover all still work.

Generated by Claude Code

- Every component and view is now <script setup lang="ts"> with typed
  props (defineProps<...>), emits and slots; main, router, data and the
  Vite/ESLint configs are .ts
- Strict tsconfig (via @vue/tsconfig) plus noUncheckedIndexedAccess and
  noUnused*; shared TimelineEvent/Member types in src/types.ts, route
  meta typed through vue-router's RouteMeta, mcsrvstat response typed
- Icon names are a union derived from the SVG path map, so an unknown
  icon is a type error
- Boolean props (alternate, continue, centered, progress) are real
  booleans; callers pass the bare attribute instead of the "true" string
- `bun run build` type-checks with vue-tsc first; `bun run typecheck`
  runs it alone and CI runs it as its own step
- ESLint uses @vue/eslint-config-typescript (typescript-eslint)

TypeScript 6.0: TypeScript 7's native compiler has no JS API yet, which
vue-tsc and typescript-eslint (<6.1) both need.

Bugs the type checker found:
- Framed bound a `classObject` that was never defined
- Credits used `credits` as both the prop and the template ref name

Also works around a vite-ssg bug: its duplicate check for the <link>s it
adds never matches, so a CSS chunk the entry already links (Splash's,
now that Rolldown splits the Vue runtime into a shared chunk) got a
second non-CORS link and was downloaded twice. onPageRendered now keeps
only the first link per URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxVDmLPux3Tx7RV1v4yznD
@mathhulk mathhulk closed this Nov 22, 2026
@mathhulk
mathhulk deleted the claude/vibrant-faraday-ux7zgr-typescript branch November 23, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants