-
-
Notifications
You must be signed in to change notification settings - Fork 362
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
remark-parse/lib/index.d.ts imports a module that cannot be referenced #1039
Comments
Can you paste some error logs? |
thanks @JounQin here is error log
|
There is indeed a https://unpkg.com/browse/[email protected]/lib/index.d.ts I'll check your reproduction soon. |
OK, it should be related to |
yes, it's related to exports. syntax-tree/mdast-util-from-markdown#29 |
https://github.com/yamachu/remark/tree/fix-lib-types With these changes, it worked in my environment. |
However, TypeScript generates: /** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */
export default function remarkParse(options: void | import("mdast-util-from-markdown/lib").Options | undefined): void;
export type Root = import('mdast').Root;
export type Options = import('mdast-util-from-markdown').Options; If we use /** @type {import('unified').Plugin<[Options?] | void[], string, Root>} */
export default function remarkParse(options: void | import("../../../node_modules/mdast-util-from-markdown/lib/index.js").Options | undefined): void;
export type Root = import('mdast').Root;
export type Options = import('mdast-util-from-markdown').Options; This appears to be a TypeScript bug (causing bugs in our output. This is definitely a bug in remark’s published packages). |
@remcohaszing I remember there was a similar issue somewhere, and that it was also reported (by you?) over at TypeScript? |
Nope, doesn't ring a bell. |
OK well I am not sure what to search for but I am pretty sure you commented on exactly this issue in one of the TypeScript repos and linked it |
@yamachu unfortunately the only workaround / solution I see so far is to use |
related? microsoft/TypeScript#38111 |
I think that’s the issue causing this indeed. Hard to believe such a critical issue has been open for over 2 years 😕 |
Closing, see #1040 (comment) |
I then solved this problem with the following settings. tsconfig.json "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"mdast-util-from-markdown/lib": [
"node_modules/mdast-util-from-markdown/lib/index.d.ts"
]
}, |
Initial checklist
Affected packages and versions
remark-parse 10.0.1
Link to runnable example
No response
Steps to reproduce
https://github.com/yamachu/remark-types-broken-repro
npx tsc --noEmit
for running type checkREPRO
Expected behavior
Pass type check without error
Actual behavior
Fail type check with error
Runtime
Node v16
Package manager
yarn 1
OS
macOS
Build and bundle tools
Other (please specify in steps to reproduce)
The text was updated successfully, but these errors were encountered: