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

Hoist Astro's type generation for type saftey in authoring enviroments #120

Open
BryceRussell opened this issue May 31, 2024 · 1 comment
Labels
bug Something isn't working Improvement Improvement to an existing feature todo Goal for next major release

Comments

@BryceRussell
Copy link
Member

When developing a theme, types are generated inside a playground. This makes it hard to properly link types while developing a theme. To improve this, types could also be generated inside the theme package to prevent issues with hoisting or circular type references.

Things to consider:

  • Types are generated using the AIK utility addDts. This utility only generates types inside a user project, this issue would require a custom utility (or an upstream addition to AIK) for type generation inside a package
  • Where are these types generated inside a package? virtual.d.ts?
@BryceRussell BryceRussell added Improvement Improvement to an existing feature todo Goal for next major release labels May 31, 2024
@BryceRussell
Copy link
Member Author

I am going to take over this issue and rename it, I worded it poorly and didn't explain exactly why I created it. Generating types inside the theme's package may have some advantages, but I don't know of any right now.

The real issue here is that theme authors need Content Collections types while developing inside a package.

This is a bit complicated because we need to generate the Content Collection types inside a playground and hoist them somehow so that authors have type safety when creating theme packages.

TLDR: Typically, types flow downwards from packages to users. We need to pass types upwards from a user to a package.

@BryceRussell BryceRussell changed the title Generate types inside a theme package Hoist Astro's type generation for type saftey in authoring enviroments Dec 11, 2024
@BryceRussell BryceRussell added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Improvement Improvement to an existing feature todo Goal for next major release
Projects
Development

No branches or pull requests

1 participant