prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

Type declarations are not exported when building.

Open bring-shrubbery opened this issue 3 years ago • 1 comments
trafficstars

Your Environment

  • Prettier version: 2.5.1
  • node version: 14.17.0
  • package manager: yarn@2
  • IDE: VScode

Describe the bug

If you take a look at this package in node_modules after you install it, there are no type declarations exported in the lib folder. There's also no types property in the package.json, so if I want use the type definition for the prettierconfig form this package - I can't do that.

To Reproduce

  1. Create new typescript project (maybe with gts?)
  2. Run npm install prettier @trivago/prettier-plugin-sort-imports'
  3. Try importing the config type and building the project if you're using type definitions from this project, the project most likely will throw Could not find a declaration file for module '@trivago/prettier-plugin-sort-imports' error.
  4. Try taking a look at the package in node_modules - there are no type declarations anywhere.

Expected behavior

Type declarations should also be generated.

Screenshots, code sample, etc

None

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

None

Error log

None

Contribute to @trivago/prettier-plugin-sort-imports

  • [x] I'm willing to fix this bug 🥇

bring-shrubbery avatar Mar 04 '22 08:03 bring-shrubbery

Just an idea: I found it very easy to use tsup for library development. It comes with very good defaults, so I actually never need to change the configuration and it outputs CommonJS and ES Module version of the code at the same time if you want.

bring-shrubbery avatar Mar 04 '22 08:03 bring-shrubbery