CDP-5979: migrate from TypeScript to JSDoc with TypeScript checking#212
Closed
senechko wants to merge 1 commit into
Closed
CDP-5979: migrate from TypeScript to JSDoc with TypeScript checking#212senechko wants to merge 1 commit into
senechko wants to merge 1 commit into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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>
7895604 to
70f48ed
Compare
Member
Author
|
Closing based on feedback — the JSDoc migration doesn't end up being simpler than the TypeScript setup it replaces. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.tssource and test files with plain.jsusing JSDoc type annotationscheckJs) and.d.tsgeneration (emitDeclarationOnly), but the compile step is no longer needed to ship — source files are the published artifacts"type": "module"in package.json)Details
Source migration (8 files + index):
@param,@returns,@typedef,@template,@enum,@type,@readonly)Object.freeze()+@enum(generatesnamespace + typein.d.tsinstead ofdeclare enum— consumers usingIdentifierType.Idare unaffected; those usingIdentifierTypeas a type get a string literal union)as const satisfies→/** @type {const} */inner cast +/** @type {ReadonlyArray<keyof T>} */outer annotationexport default class→export default class(preserved naturally in ESM)Tooling changes:
module/moduleResolution→"nodenext", addedcheckJs,emitDeclarationOnlynyc→c8(V8-native coverage, ESM-compatible)ts-nodedependencynpx ts-node ./check-version.ts→node ./check-version.js.prettierrc.js→.prettierrc.cjs(CJS config in ESM package)Package entry points:
"main": "index.js"(wasdist/index.js)"types": "dist/index.d.ts"(unchanged — still generated bytsc)"files"includesindex.js,lib/, anddist/(.d.tsonly)Test plan
npm run buildgenerates.d.tsfiles indist/npm run lintpassesimport { TrackClient, IdentifierType } from 'customerio-node'works.d.tsoutput includes all public exports🤖 Generated with Claude Code