0.2.5 • Published 6 months ago

@types/vite-plugin-react-svg v0.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/vite-plugin-react-svg

Summary

This package contains type definitions for vite-plugin-react-svg (https://github.com/visualfanatic/vite-svg).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/vite-plugin-react-svg.

index.d.ts

// Type definitions for vite-plugin-react-svg 0.2
// Project: https://github.com/visualfanatic/vite-svg
// Definitions by: Priyanshu Rav <https://github.com/priyanshurav>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 4.0

import { Plugin } from 'vite';
import { OptimizeOptions } from 'svgo';
import * as React from 'react';

interface Options {
    /**
     * Default behavior when importing `.svg` files, possible options are: `url` and `component`.
     *
     * Default value: `url`
     */
    defaultExport?: 'url' | 'component';
    /** Boolean flag to enable/disable SVGO */
    svgo?: boolean;
    /** Specify SVGO config */
    svgoConfig?: OptimizeOptions;
    /** Props to be forwarded on SVG tag, possible options: `start`, `end` or `false` */
    expandProps?: 'start' | 'end' | false;
    /** Setting this to `true` will forward ref to the root SVG tag */
    ref?: boolean;
    /** Setting this to `true` will wrap the exported component in `React.memo` */
    memo?: boolean;
    /**
     * Replace an attribute value by another.
     * The main usage of this option is to change an icon color to `currentColor` in order to inherit from text color.
     */
    replaceAttrValues?: Record<string, unknown>;
    /** Add props to the root SVG tag */
    svgProps?: React.SVGAttributes<SVGSVGElement>;
    /** Add title tag via `title` property */
    titleProp?: boolean;
}

declare function reactSvgPlugin(options?: Options): Plugin;

export = reactSvgPlugin;

Additional Details

Credits

These definitions were written by Priyanshu Rav.

0.2.3

8 months ago

0.2.5

6 months ago

0.2.4

7 months ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

3 years ago