-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(fonts): typegen for <Font /> family prop #13465
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
feat(fonts): typegen for <Font /> family prop #13465
Conversation
|
| @@ -0,0 +1,4 @@ | |||
| declare module 'astro:assets' { | |||
| /** Run `astro dev` or `astro sync` to generate high fidelity types */ | |||
| export type FontFamily = string; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a better way? This should be considered an internal type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide some context? I'm not sure I understand what you're trying to achieve and what's the limitation of the current solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it was clear for me of course 😆
So what I want is:
- By default, the
familyprop of theFontcomponent must be typed as string - If some fonts are registered, make this prop strictly typed using codegen
This currently works but I'm using astro:assets to pass the type. I think this makes FontFamily part of the public API but it should be considered internal IMO.
So what can we do about it? I guess an easy way would be to add @internal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use @internal. How would users use the generated type instead?
Changes
Fontcomponent family propfamily.asif providedTesting
Updated + manual
Docs
N/A