feat: add JSDoc + checkJs TypeScript type checking (Option B)#54
Conversation
Agent-Logs-Url: https://github.com/nitrocode/token-deathclock/sessions/1a4be6ae-b332-43e6-91e1-3bda4d2869fa Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
👁️ PR Preview
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 233 233
Branches 107 107
=========================================
Hits 233 233
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Enables TypeScript's type checker on the existing
.jssource without a build step or syntax migration — the browser still loads the original files directly.New files
tsconfig.json—checkJs: true,strict: true,noEmit: true; scope limited todeath-clock-core.jsandscripts/*.jsglobal.d.ts— extendsWindowwith the project's dual-export globals (MilestonesData,DeathClockCore,ChangelogData,ProjectStatsData) and declares theMilestone/ChangelogReleaseinterfacesBugs surfaced and fixed by the type checker
Datearithmetic —d - basereplaced withd.getTime() - base.getTime()ingenerateProjectionDataandgetTimeDelta; TypeScript correctly rejects implicitDatesubtractionObject—computePassiveRateparams tightened from{Object}to{Object.<string, number>}/{Object.<string, boolean>}soagents[a.id]androles[r.id]are safenever[]inference in build-changelog —currentRelease.sectionsandcurrentSection.itemswere inferred asnever[], silently makingpush()a no-op for TypeScript; fixed with explicit@typedef+@typeannotationsyaml.load()results —docinbuild-milestones.jsandbuild-project-stats.jscast to typed shapes so property access is checkedJSDoc annotation improvements
{Array}→{Milestone[]}/{Milestone|null}ingetTriggeredMilestones,getNextMilestone,getNextMilestoneForPlayer— callback access to.tokensis now statically verified@param/@typedefCI
npm run typecheck(tsc --noEmit) added as a step inunit-tests.yml, running before Jest, so type regressions fail the PR.