Skip to content

@svgr/cli does not include its type definitions#1017

Description

@raygesualdo

馃悰 Bug Report

There are no type definitions shipped with the @svgr/cli package. Because there's no main entry in that package's package.json, the .d.ts files are not generated.

I'd be happy to create a PR for this. My thinking was to add another conditional at build/rollup.config.mjs:11 such that if pkg.main doesn't exist, it looks next for pkg.types before falling back to the default './dist/index' value.

To Reproduce

  1. Install the @svgr/cli dependency in a TypeScript project
  2. Try to import types, e.g. import { Options } from "@svgr/cli";
  3. TypeScript shows the following error on the import: Cannot find module '@svgr/cli' or its corresponding type declarations. ts(2307)

Expected behavior

The Options and SvgrCommand are shipped with the package and are importable in consuming projects.

Link to repl or repo (highly encouraged)

The issue is reproducible in this TypeScript playground.

Run npx envinfo --system --binaries --npmPackages @svgr/core,@svgr/cli,@svgr/webpack,@svgr/rollup --markdown --clipboard

Paste the results here:

## System:
 - OS: macOS 26.2
 - CPU: (14) arm64 Apple M4 Max
 - Memory: 803.25 MB / 36.00 GB
 - Shell: 5.9 - /bin/zsh
## Binaries:
 - Node: 22.20.0 - ~/.asdf/installs/nodejs/22.20.0/bin/node
 - npm: 10.9.3 - ~/.asdf/plugins/nodejs/shims/npm
 - pnpm: 10.18.1 - ~/.asdf/shims/pnpm
## npmPackages:
 - @svgr/cli: ^8.1.0 => 8.1.0 
 - @svgr/core: ^8.1.0 => 8.1.0 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions