Update, improve and refactor JSDocs types for core
Currently we have a custom JSDoc type setup and was created before typescript supported JSDoc types natively. It's about time we modernize this 😅
We need to refactor how the types get emitted to just using regular TypeScripts and emit out the file.
Also, while you're at it, we need to check out the doc types and verify that everything is correct.
So all the code will remain JS but be types with JSDocs. Start with the types in core https://github.com/DavidWells/analytics/tree/master/packages/analytics-core/src
The "types": "../../node_modules/.bin/jsdoc -t ../../node_modules/tsd-jsdoc/dist -r ./src/ -d _temp-types && node scripts/types.js", is ollllddddd and clunky.
Thanks @claude
Hey @claude read above. Lets do this
Claude finished @DavidWells's task in 7m 22s —— View job • claude/issue-465-20250619_005039 • Create PR ➔
Successfully Modernized JSDoc Types for Analytics Core! ✅
I've successfully updated and refactored the JSDoc types for the analytics-core package to use modern TypeScript JSDoc support instead of the old custom system.
Todo List
- [x] Read repository setup instructions (CLAUDE.md)
- [x] Analyze current analytics-core package structure and JSDoc setup
- [x] Examine existing type generation scripts and dependencies
- [x] Create TypeScript configuration for JSDoc-based type generation
- [x] Update JSDoc comments to modern TypeScript syntax
- [x] Remove old tsd-jsdoc dependency and scripts
- [x] Update package.json types script
- [x] Test the new setup by generating types
- [x] Clean up outdated dependencies
Changes Made
✨ Modernized Type System:
- Created
packages/analytics-core/tsconfig.jsonwith modern TypeScript configuration for JSDoc-based type generation - Added comprehensive type definitions in
packages/analytics-core/src/types.jsusing modern TypeScript JSDoc syntax - Updated all JSDoc comments throughout the codebase to use modern
@paramand@returnssyntax
🗑️ Removed Legacy System:
- Deleted obsolete
scripts/types.jscustom type processing script - Deleted old
src/pluginTypeDef.jsfile (consolidated intotypes.js) - Removed
tsd-jsdocdependency from rootpackage.json - Updated package.json
typesscript from complex JSDoc command to simpletsc
📝 Updated Configuration:
- Changed types field in package.json to point to
dist/index.d.ts(generated by TypeScript) - Updated prebuild script to remove unnecessary
_temp-typescleanup - Modernized JSDoc comments in
index.js,modules/page.js, andconstants.js
Benefits of the New System
- Cleaner & Maintainable: No more complex post-processing scripts - TypeScript handles everything natively
- Modern Standards: Uses TypeScript's native JSDoc support instead of outdated tooling
- Better IDE Support: Modern TypeScript JSDoc provides superior IntelliSense and type checking
- Simplified Build: One command (
tsc) instead of a complex pipeline - Future-Proof: Built on actively maintained TypeScript compiler
The code remains JavaScript with JSDoc comments, but now uses TypeScript's modern, native type generation capabilities. This provides the same type safety benefits with a much cleaner and more maintainable setup.
❌ Automatic PR creation failed
Error: Command failed: git push origin claude-fix/issue-465-20250619T0058
Solution: Create a PR manually or rerun with claude
Details: Actions run log
💬 Claude Code execution complete
📊 Execution Info: Issue #465 | Unknown (401 files) | @DavidWells
🚀 Automated management executed:
- ✅ Created: claude-code
- ✅ Created: auto-generated
- ✅ Created: 2025-Jun
💡 Example commands for Claude:
🔍 Analysis & Review:
claude Please review the codeclaude Please perform a security checkclaude Please suggest performance improvements
🛠️ Tasks & Implementation:
claude Please add test casesclaude Please fix this issue and create a PRclaude Please suggest refactoring
📚 Management & Operations:
claude Please create a releaseclaude Please check security alertsclaude Please optimize the workflow
📋 Issue Specific:
claude Please investigate the root cause of this issueclaude Please propose multiple solutions
🔄 Rerun: You can run again anytime with claude [your instructions]