Skip to content

fix: remove typescript syntax from js modules#177

Open
bennypowers wants to merge 2 commits intomainfrom
fix/ts-syntax-in-js
Open

fix: remove typescript syntax from js modules#177
bennypowers wants to merge 2 commits intomainfrom
fix/ts-syntax-in-js

Conversation

@bennypowers
Copy link
Member

Fixes #176

@bennypowers bennypowers requested a review from Copilot January 14, 2026 14:22
@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 6085fa8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@rhds/tokens Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link

netlify bot commented Jan 14, 2026

Deploy Preview for red-hat-design-tokens failed. Why did it fail? →

Name Link
🔨 Latest commit 6085fa8
🔍 Latest deploy log https://app.netlify.com/projects/red-hat-design-tokens/deploys/697afc03216472000881e084

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an issue where .cjs files contained TypeScript syntax, breaking compatibility with tools like @jspm/generator that don't support TypeScript in CommonJS modules. The fix converts the CommonJS format generators to produce pure JavaScript with JSDoc type annotations instead of TypeScript syntax.

Changes:

  • Rewrote mapCjs and metaMapCjs format generators to output pure JavaScript with JSDoc instead of relying on TypeScript-to-JavaScript string replacement
  • Added smoke tests to verify .cjs files can be loaded by Node.js without type stripping
  • Updated wireit test configuration to include the new smoke tests

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
lib/formats/map.ts Replaced TypeScript-based generation with pure JavaScript output using JSDoc for both mapCjs and metaMapCjs formats
test/smoke.cjs Added comprehensive smoke tests to validate .cjs files load correctly in Node.js without TypeScript support
package.json Added test:smoke script and configured it as a test dependency
.changeset/polite-walls-invite.md Added changeset documenting the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

js/tokens.cjs contains TypeScript type annotations, breaking @jspm/generator

2 participants