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

<Code /> component theme "css-variables" incorrectly typed #10246

Closed
1 task
Ehesp opened this issue Feb 27, 2024 · 1 comment · Fixed by #10251
Closed
1 task

<Code /> component theme "css-variables" incorrectly typed #10246

Ehesp opened this issue Feb 27, 2024 · 1 comment · Fixed by #10251
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord

Comments

@Ehesp
Copy link

Ehesp commented Feb 27, 2024

Astro Info

Astro                    v4.2.6
Node                     v20.11.0
System                   macOS (arm64)
Package Manager          unknown
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/tailwind
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

N/A

Describe the Bug

The following code throws a TypeScript error: Type '"css-variables"' is not assignable to type 'BundledTheme | ThemeRegistration | ThemeRegistrationRaw | undefined'.ts(2322)

<Code theme="css-variables" />

This is a valid theme from Shiki, and the outcome is it works as expected (and expects some defined css variables).

What's the expected result?

No TS error.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-uhurkz?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 27, 2024
@bluwy
Copy link
Member

bluwy commented Feb 27, 2024

Ahh we should probably use this type:

export type ThemePresets = BuiltinTheme | 'css-variables';

Here instead:

theme?: BuiltinTheme | ThemeRegistration | ThemeRegistrationRaw;

experimentalThemes?: Record<string, BuiltinTheme | ThemeRegistration | ThemeRegistrationRaw>;

ThemePresets replaces BuiltinTheme

@bluwy bluwy added - P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord and removed needs triage Issue needs to be triaged labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) good first issue Good for newcomers. If you need additional guidance, feel free to post in #dev on Discord
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants