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

Unable to import types in v6 #9583

Open
monken opened this issue Apr 4, 2025 · 5 comments · May be fixed by #9584
Open

Unable to import types in v6 #9583

monken opened this issue Apr 4, 2025 · 5 comments · May be fixed by #9584
Labels

Comments

@monken
Copy link

monken commented Apr 4, 2025

Bug Description

import type { NonNormalizedSpec } from 'vega-lite/build/src/spec';

Pre v6, I was able to import types like NonNormalizedSpec from the spec file. Since v6 (and the switch to ESM), I'm no longer able to reach these types. It would be great if the spec file could get exposed as a module again so that I can migrate to v6.

@monken monken added the Bug 🐛 label Apr 4, 2025
@domoritz
Copy link
Member

domoritz commented Apr 4, 2025

Ahh, I see. Thanks for reporting. To explain, since we added explicit exports, you can't import arbitrary files anymore. There is a hack to expose every file but it's problematic since we don't want to expose all internals as public API. We could still do it but they wouldn't be stable API.

How do you suggest we expose the types? We could expose specific types but I would still want to mark them as not stable.

@monken
Copy link
Author

monken commented Apr 4, 2025

I think it would be sufficient to add the https://github.com/vega/vega-lite/blob/main/src/spec/index.ts file to the exports in package.json.

https://github.com/vega/vega-lite/blob/main/package.json#L27

@domoritz
Copy link
Member

domoritz commented Apr 4, 2025

Okay. Do you have an idea how we can mark it as exported yet unstable?

@domoritz domoritz linked a pull request Apr 5, 2025 that will close this issue
@domoritz
Copy link
Member

domoritz commented Apr 5, 2025

Fixed in #9584. I need a careful review of the changes I made there.

@monken
Copy link
Author

monken commented Apr 5, 2025

vega-lite/types_unstable is a great compromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants