Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown-it import path does not align with current package #124

Closed
rajsite opened this issue Aug 2, 2024 · 1 comment
Closed

Markdown-it import path does not align with current package #124

rajsite opened this issue Aug 2, 2024 · 1 comment

Comments

@rajsite
Copy link

rajsite commented Aug 2, 2024

The following Token import does not align with what is exported from markdown-it:

import Token from "markdown-it/lib/token"

This is not detected by TypeScript because the package is currently using v13 types with the v14 package.

The v14 package switched to esm exports, but did not define bare module paths. So if you clone this repo, update to the v14 types and look in vscode you get errors about the bare module import of Token not existing:

image

This caused an issue for us upstream as we tweak some MarkdownParser behavior so imported the v13 types and with an attempted upgrade of our types to v14 our TypeScript build was failing.

Because this is a type only import it seems to be safe to update the types to v14 and update the import to:

import type Token from "markdown-it/lib/token.mjs";

Which is elided from the cjs/js builds (the different cjs/mjs exports never include the type import) and it fixes the TypeScript issues.

@marijnh
Copy link
Member

marijnh commented Aug 5, 2024

Thanks for spotting that. Attached patch upgrades the dependency. import type doesn't seem to be needed—TypeScript will automatically drop type-only imports from its build output.

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

No branches or pull requests

2 participants