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

Error configuring Experimental SVG components #12708

Closed
1 task
cworld1 opened this issue Dec 10, 2024 · 2 comments
Closed
1 task

Error configuring Experimental SVG components #12708

cworld1 opened this issue Dec 10, 2024 · 2 comments
Labels
needs triage Issue needs to be triaged

Comments

@cworld1
Copy link

cworld1 commented Dec 10, 2024

Astro Info

Astro                    v5.0.3
Node                     v23.3.0
System                   Windows (x64)
Package Manager          bun
Output                   static
Adapter                  none
Integrations             none

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

No response

Describe the Bug

Problem:

Type 'true' has no properties in common with type '{ mode?: SvgRenderMode | undefined; }'.ts(2559)
(property) svg?: {
    mode?: SvgRenderMode;
} | undefined

Refer to code at astro/dist/types/public/config.d.ts:

        /**
         *
         * @name experimental.svg
         * @type {boolean|object}
         * @default `undefined`
         * @version 5.x
         * @description
         *
         * This feature allows you to import SVG files directly into your Astro project. By default, Astro will inline the SVG content into your HTML output.
         *
         * To enable this feature, set `experimental.svg` to `true` in your Astro config:
         *
         * ```js
         * {
         *   experimental: {
         * 	   svg: true,
         * 	 },
         * }
         * ```
         *
         * To use this feature, import an SVG file in your Astro project, passing any common SVG attributes to the imported component.
         * Astro also provides a `size` attribute to set equal `height` and `width` properties:
         *
         * ```astro
         * ---
         * import Logo from './path/to/svg/file.svg';
         * ---
         *
         * <Logo size={24} />
         * ```
         *
         * For a complete overview, and to give feedback on this experimental API,
         * see the [Feature RFC](https://github.com/withastro/roadmap/pull/1035).
         */
        svg?: {
            /**
             *
             * @name experimental.svg.mode
             * @type {string}
             * @default 'inline'
             *
             * The default technique for handling imported SVG files. Astro will inline the SVG content into your HTML output if not specified.
             *
             * - `inline`: Astro will inline the SVG content into your HTML output.
             * - `sprite`: Astro will generate a sprite sheet with all imported SVG files.
             *
             * ```astro
             * ---
             * import Logo from './path/to/svg/file.svg';
             * ---
             *
             * <Logo size={24} mode="sprite" />
             * ```
             */
            mode?: SvgRenderMode;
        };
    };

It shows the config can only set value like:

  experimental: {
    svg: {
      mode: 'sprite'
    }
  }

Which is incorrect with the decleration or documention.

What's the expected result?

  experimental: {
    svg: true
  }

Link to Minimal Reproducible Example

It is about the source code.

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 Dec 10, 2024
@stramel
Copy link
Contributor

stramel commented Dec 11, 2024

I believe this was fixed by #12625

@cworld1
Copy link
Author

cworld1 commented Dec 11, 2024

@stramel I checked at npm site, it is actually fixed in the latest version. Thank you!

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

No branches or pull requests

3 participants