Skip to content

CDP-5979: migrate from TypeScript to JSDoc with TypeScript checking#212

Closed
senechko wants to merge 1 commit into
mainfrom
worktree-cdp-5979-jsdoc-migration
Closed

CDP-5979: migrate from TypeScript to JSDoc with TypeScript checking#212
senechko wants to merge 1 commit into
mainfrom
worktree-cdp-5979-jsdoc-migration

Conversation

@senechko
Copy link
Copy Markdown
Member

Summary

  • Replaces all .ts source and test files with plain .js using JSDoc type annotations
  • TypeScript still provides type checking (checkJs) and .d.ts generation (emitDeclarationOnly), but the compile step is no longer needed to ship — source files are the published artifacts
  • Module system changed from CJS to ESM ("type": "module" in package.json)

Details

Source migration (8 files + index):

  • TypeScript syntax → JSDoc annotations (@param, @returns, @typedef, @template, @enum, @type, @readonly)
  • Enums → Object.freeze() + @enum (generates namespace + type in .d.ts instead of declare enum — consumers using IdentifierType.Id are unaffected; those using IdentifierType as a type get a string literal union)
  • as const satisfies/** @type {const} */ inner cast + /** @type {ReadonlyArray<keyof T>} */ outer annotation
  • export default classexport default class (preserved naturally in ESM)

Tooling changes:

  • tsconfig: module/moduleResolution"nodenext", added checkJs, emitDeclarationOnly
  • Coverage: nycc8 (V8-native coverage, ESM-compatible)
  • Removed ts-node dependency
  • Pre-commit hook: npx ts-node ./check-version.tsnode ./check-version.js
  • Prettier config: .prettierrc.js.prettierrc.cjs (CJS config in ESM package)

Package entry points:

  • "main": "index.js" (was dist/index.js)
  • "types": "dist/index.d.ts" (unchanged — still generated by tsc)
  • "files" includes index.js, lib/, and dist/ (.d.ts only)

Test plan

  • All 169 tests pass with 100% coverage
  • npm run build generates .d.ts files in dist/
  • npm run lint passes
  • Smoke test: import { TrackClient, IdentifierType } from 'customerio-node' works
  • Verify .d.ts output includes all public exports

🤖 Generated with Claude Code

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 29, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedc8@​11.0.09910010083100

View full report

Replace .ts source files with plain .js using JSDoc type annotations.
TypeScript still provides type checking (checkJs) and .d.ts generation
(emitDeclarationOnly), but the build step is no longer needed to ship —
source files are the published artifacts.

Key changes:
- All .ts source and test files converted to .js with JSDoc annotations
- Module system changed from CJS to ESM ("type": "module")
- tsconfig: module/moduleResolution switched to "nodenext"
- Coverage tool switched from nyc to c8 (ESM-compatible)
- Removed ts-node and sync-version.js (version reads from package.json)
- Enums become frozen const objects (minor .d.ts shape change)
- Prettier config renamed to .cjs for CJS compat with "type": "module"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@senechko senechko force-pushed the worktree-cdp-5979-jsdoc-migration branch from 7895604 to 70f48ed Compare June 1, 2026 17:16
@senechko
Copy link
Copy Markdown
Member Author

senechko commented Jun 1, 2026

Closing based on feedback — the JSDoc migration doesn't end up being simpler than the TypeScript setup it replaces.

@senechko senechko closed this Jun 1, 2026
@senechko senechko deleted the worktree-cdp-5979-jsdoc-migration branch June 1, 2026 17:20
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.

1 participant