Fix missing TypeScript declarations in published package#850
Merged
quantizor merged 2 commits intoquantizor:mainfrom Mar 20, 2026
Merged
Fix missing TypeScript declarations in published package#850quantizor merged 2 commits intoquantizor:mainfrom
quantizor merged 2 commits intoquantizor:mainfrom
Conversation
…ration generation UNICODE_PUNCT_R and UNICODE_WHITESPACE_R were exported vars without explicit type annotations. @bunup/dts uses oxc-transform's isolatedDeclaration() to generate .d.ts files, which requires all exported bindings to have explicit types. Without them, TS9010 errors are emitted. In CI (isCI=true), these errors are fatal and cause process.exit(1) before any .d.ts files are written — which is why published packages v9.7.10 and v9.7.11 were missing their type declarations entirely. Closes quantizor#849
🦋 Changeset detectedLatest commit: 56f27dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Contributor
Author
|
Just added a changeset after seeing that message... let me know if that's not enough detail for the |
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.
When a codebase uses
v9.7.11(and likely other versions too) an error is produced when importingmarkdown-to-jsxin a TypeScript project:Refer to issue #849.
Root cause
(According to AI)
UNICODE_PUNCT_RandUNICODE_WHITESPACE_Rinutils.tswere exportedvardeclarations without explicit type annotations. The build tool (@bunup/dts) usesoxc-transform'sisolatedDeclaration()to generate.d.tsfiles, which requires all exported bindings to have explicit types — without them it emits TS9010 errors.In CI these errors are fatal (
process.exit(1)is called before any.d.tsfiles are written), so the published package ships without declarations. Locally the errors are non-fatal warnings, which is why the build appears to succeed.The fix
Add
: RegExptype annotations to both variables — two characters of change each.Verification
The
CI=truevariable needs to be set to see the problem locally:Once the type annotations have been added, it passes.
git checkout fix-typescript CI=true bun run build # succeeds locallyAI disclosure
Just a heads up, I used AI to find and implement this solution but did my own testing to prove that it works.
The tests are all passing either way and I've tested using this package in my own repo that was otherwise failing via
yalc.