# typed-inline-svg

> Create .d.ts files for your .svg files

Latest version **1.0.2** (published 2020-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install typed-inline-svg
pnpm add typed-inline-svg
yarn add typed-inline-svg
bun add typed-inline-svg
```

Provides the command `typed-inline-svg`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-07-20 |
| First published | 2020-06-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 10.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Thiago Camargo |
| Maintainers | gasparsigma |
| Keywords | typescript, typed, svg |

## Links

- npm: https://www.npmjs.com/package/typed-inline-svg
- Repository: https://github.com/gasparsigma/typed-inline-svg
- Homepage: https://github.com/gasparsigma/typed-inline-svg#readme
- Issues: https://github.com/gasparsigma/typed-inline-svg/issues
- npm.io page: https://npm.io/package/typed-inline-svg

## Dependencies (3)

- [glob](https://npm.io/package/glob.md) ^7.1.6
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [yargs](https://npm.io/package/yargs.md) ^15.3.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-07-20
- 1.0.1 — 2020-06-24
- 1.0.0 — 2020-06-24

## README

# typed-inline-svg

CLI tool to create `.d.ts` files for `.svg` files of your React project

Recommended if you have a transpiler that allow importing of .svg files, for example the Babel plugin `inline-react-svg`

Serves as an alternative to a generic `declare module "*.svg"` which will not catch at compile time the import of the wrong file path/name

## Install

```sh
npm i -D typed-inline-svg
```

## Usage

```sh
npx typed-inline-svg <svgsRoot>
```

## Example

If this is your project

```text
(your project root)
- src/
    | my-feature-one
      | ft-one.svg
    | my-feature-two
      | ft-two.svg
```

You can run `npx typed-inline-svg src` and expect

```text
(your project root)
- src/
    | my-feature-one
      | ft-one.svg
      | ft-one.svg.d.ts [created]
    | my-feature-two
      | ft-two.svg
      | ft-two.svg.d.ts [created]
```

The content of the definition files is

```ts
declare const svgFactory: React.SVGFactory;
export = svgFactory;
```

## CLI Options

```text
-s: silent mode - will omit logging unless there is a usage error
```

## Contributing

If you have a need not fulfilled by this tool and would like to contribute, for example, generating definitions files that are not for a React project or some other cli options, feel free to fork the repository and contribute

## Remarks

You can have commit the definitions at your source control but I'd recommend ignore all `*.svg.d.ts` and generate it at your npm `prepare` script

Inspired by [typed-css-modules](https://www.npmjs.com/package/typed-css-modules)

## License

This software is released under the MIT License, see LICENSE.txt

---
_Source: https://npm.io/package/typed-inline-svg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
