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

Don't depend on yaml/dist/doc/directives, or get yaml to export Directives #175

Closed
alecmev opened this issue Mar 7, 2024 · 2 comments · Fixed by #187
Closed

Don't depend on yaml/dist/doc/directives, or get yaml to export Directives #175

alecmev opened this issue Mar 7, 2024 · 2 comments · Fixed by #187
Labels
help wanted Extra attention is needed

Comments

@alecmev
Copy link
Contributor

alecmev commented Mar 7, 2024

yaml doesn't export it, unfortunately, so TypeScript says this with skipLibCheck: false:

node_modules/yaml-eslint-parser/lib/utils.d.ts:1:33 - error TS2307: Cannot find module 'yaml/dist/doc/directives' or its corresponding type declarations.

1 import type { Directives } from "yaml/dist/doc/directives";

One solution I see is to instead use DocumentOptions:

import type { DocumentOptions } from "yaml";
export type YAMLVersion = NonNullable<DocumentOptions['version']>

Another solution is to talk to yaml and get them to re-export Directives in index.ts.

@alecmev
Copy link
Contributor Author

alecmev commented Apr 26, 2024

@ota-meshi Pinging, in case this fell through the cracks.

@ota-meshi
Copy link
Owner

Thank you for posting this issue.
Hmm. Maybe the type has changed in a minor version. Would you consider opening a pull request?

@ota-meshi ota-meshi added the help wanted Extra attention is needed label May 17, 2024
alecmev added a commit to alecmev/yaml-eslint-parser that referenced this issue May 17, 2024
alecmev added a commit to alecmev/yaml-eslint-parser that referenced this issue May 17, 2024
ota-meshi added a commit that referenced this issue May 24, 2024
* Make it fail in ESM mode

* Fix yaml import in ESM

Fix #175

* Add changeset

---------

Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants